public abstract class TSHandler extends Object implements Service, TSIdentification
Modifier and Type | Field and Description |
---|---|
protected Receiver |
receiver
A Receiver instance
|
protected Sender |
sender
A Sender instance
|
protected int |
service_id
The transaction service id.
|
Modifier | Constructor and Description |
---|---|
protected |
TSHandler() |
protected |
TSHandler(int service_id,
Sender sender,
Receiver receiver) |
protected |
TSHandler(Sender sender,
Receiver receiver)
Creates a new TSHandler instance.
|
Modifier and Type | Method and Description |
---|---|
protected abstract PropagationContext |
decodeContext(ServiceContext sc)
Decodes a PropagationContext instance from a ServiceContext instance.
|
protected abstract ServiceContext |
encodeContext(PropagationContext ctx)
Encodes the provided PropagationContext into a ServiceContext.
|
ServiceContext |
getReplyContext(int request_id,
org.objectweb.jonathan.apis.kernel.Context ignored)
Returns a reply context.
|
ServiceContext |
getRequestContext(int request_id,
boolean response_expected,
byte[] object_key,
org.objectweb.jonathan.apis.kernel.Context ignored)
Returns a request context.
|
void |
handleReplyContext(ServiceContext context,
int request_id,
org.objectweb.jonathan.apis.kernel.Context ignored)
This method is called by the services handler to let the operations
related to the target service be performed on reply arrival.
|
void |
handleRequestContext(ServiceContext context,
int request_id,
boolean response_expected,
byte[] object_key,
org.objectweb.jonathan.apis.kernel.Context ignored)
This method is called by the services handler to let the operations
related to the target service be performed on request arrival.
|
void |
identify_receiver(Receiver receiver) |
void |
identify_sender(Sender sender) |
protected Sender sender
protected Receiver receiver
protected int service_id
protected TSHandler(Sender sender, Receiver receiver) throws org.objectweb.jonathan.apis.kernel.JonathanException
org.objectweb.jonathan.apis.kernel.JonathanException
protected TSHandler(int service_id, Sender sender, Receiver receiver) throws org.objectweb.jonathan.apis.kernel.JonathanException
org.objectweb.jonathan.apis.kernel.JonathanException
protected TSHandler()
public void identify_sender(Sender sender) throws NotAvailable, AlreadyIdentified
identify_sender
in interface TSIdentification
NotAvailable
AlreadyIdentified
public void identify_receiver(Receiver receiver) throws NotAvailable, AlreadyIdentified
identify_receiver
in interface TSIdentification
NotAvailable
AlreadyIdentified
public ServiceContext getRequestContext(int request_id, boolean response_expected, byte[] object_key, org.objectweb.jonathan.apis.kernel.Context ignored)
If sender
is not null, this method encodes
the propagation context
returned by its sending_request
method, else it returns null.
getRequestContext
in interface Service
request_id
- the request identifier;response_expected
- unused;object_key
- unused.ignored
- the context of the request marshaller.public ServiceContext getReplyContext(int request_id, org.objectweb.jonathan.apis.kernel.Context ignored)
If receiver
is not null, this method encodes
the propagation context
returned by its sending_reply
method, else it returns null.
getReplyContext
in interface Service
request_id
- the corresponding request id.ignored
- the context of the reply marshaller.public void handleRequestContext(ServiceContext context, int request_id, boolean response_expected, byte[] object_key, org.objectweb.jonathan.apis.kernel.Context ignored)
If receiver
is null, this method returns immediately.
Else, it uses the decodeContext
method to obtain a PropagationContext instance, and call the
received_request
method on it.
handleRequestContext
in interface Service
context
- the service context of the request;request_id
- the request identifier;response_expected
- unused;object_key
- unused.ignored
- the context of the request unmarshaller.public void handleReplyContext(ServiceContext context, int request_id, org.objectweb.jonathan.apis.kernel.Context ignored)
If sender
is null, this method returns immediately.
Else, it uses the decodeContext
method to obtain a PropagationContext instance, and call the
received_reply
method on it.
handleReplyContext
in interface Service
context
- the service context of the reply;request_id
- the corresponding request identifier.ignored
- the context of the reply unmarshaller.protected abstract ServiceContext encodeContext(PropagationContext ctx)
ctx
- a PropagationContext instance.protected abstract PropagationContext decodeContext(ServiceContext sc)
sc
- a ServiceContext instance.