Annotation Interface Batched


@Documented @Retention(RUNTIME) @Target(METHOD) public @interface Batched
Designates a remote method as being batched, which can be used to reduce transport overhead. Method calls are sent to the remote endpoint, but the pipe isn't immediately flushed. The calling thread holds the same pipe for making additional method calls until a non-batched method is called. All method calls received by the remote endpoint are executed in one thread, in the original order.

A batched method must declare returning void or a Remote object. Returning a remote object allows batched calls to be chained together.

@Batched
void setOption(int option) throws RemoteException;

@Batched
RemoteAccess login(String user, String password) throws RemoteException, AuthFailure;

Batched methods can declare throwing any exception, and any exception thrown by the remote endpoint aborts the batch operation. The exception is thrown to the caller of the method that flushed the batch. If this method does not declare throwing the proper exception type, it's wrapped by UndeclaredThrowableException. Any Remote objects returned from batched method calls at or after the exception point will be disposed, and so they should not be used.

See Also: