class DiscoveryV1 extends Discovery
Modifier and Type | Field and Description |
---|---|
private static DiscoveryV1 |
instance |
private static Logger |
logger |
private static int |
SERVICE_ID_LEN |
MIN_MAX_PACKET_SIZE, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2
Constructor and Description |
---|
DiscoveryV1() |
Modifier and Type | Method and Description |
---|---|
private static void |
checkConstraints(InvocationConstraints constraints) |
MulticastAnnouncement |
decodeMulticastAnnouncement(DatagramPacket packet,
InvocationConstraints constraints)
Decodes the multicast announcement data contained in the given datagram
in a manner that satisfies the specified constraints, returning a
MulticastAnnouncement instance that contains the decoded data. |
MulticastRequest |
decodeMulticastRequest(DatagramPacket packet,
InvocationConstraints constraints,
ClientSubjectChecker checker)
Decodes the multicast request data contained in the given datagram in a
manner that satisfies the specified constraints and client subject
checker (if any), returning a
MulticastRequest instance that
contains the decoded data. |
UnicastResponse |
doUnicastDiscovery(Socket socket,
InvocationConstraints constraints,
ClassLoader defaultLoader,
ClassLoader verifierLoader,
Collection context)
Performs the client side of unicast discovery, obtaining the returned
response data over the provided socket using the given default and
codebase verifier class loaders and collection of object stream context
objects in a manner that satisfies the specified constraints.
|
private static DatagramPacket[] |
encode(MulticastAnnouncement announcement,
int maxPacketSize,
InvocationConstraints constraints) |
private static DatagramPacket[] |
encode(MulticastRequest request,
int maxPacketSize,
InvocationConstraints constraints) |
EncodeIterator |
encodeMulticastAnnouncement(MulticastAnnouncement announcement,
int maxPacketSize,
InvocationConstraints constraints)
Returns an iterator which can be used to encode the given multicast
announcement data into sets of
DatagramPacket s, each bounded in
length by the specified maximum packet size, in a manner that satisfies
the given constraints. |
EncodeIterator |
encodeMulticastRequest(MulticastRequest request,
int maxPacketSize,
InvocationConstraints constraints)
Returns an iterator which can be used to encode the given multicast
request data into sets of
DatagramPacket s, each bounded in
length by the specified maximum packet size, in a manner that satisfies
the given constraints. |
(package private) static DiscoveryV1 |
getInstance() |
void |
handleUnicastDiscovery(UnicastResponse response,
Socket socket,
InvocationConstraints constraints,
ClientSubjectChecker checker,
Collection context)
Handles the server side of unicast discovery, transmitting the given
response data over the provided socket using the given collection of
object stream context objects in a manner that satisfies the specified
constraints and client subject checker (if any).
|
String |
toString() |
decodeMulticastAnnouncement, decodeMulticastRequest, getProtocol1, getProtocol2, getProtocol2
private static final int SERVICE_ID_LEN
private static final DiscoveryV1 instance
private static final Logger logger
static DiscoveryV1 getInstance()
public EncodeIterator encodeMulticastRequest(MulticastRequest request, int maxPacketSize, InvocationConstraints constraints)
Discovery
DatagramPacket
s, each bounded in
length by the specified maximum packet size, in a manner that satisfies
the given constraints. null
constraints are considered
equivalent to empty constraints. The destination of each
DatagramPacket
produced by the returned iterator is set to
the address returned by
Constants.getRequestAddress()
, with the value
of Constants.discoveryPort
used as the
destination port.encodeMulticastRequest
in class Discovery
request
- the request data to encodemaxPacketSize
- the maximum size of packets to produceconstraints
- the constraints to apply when encoding the data, or
null
private static DatagramPacket[] encode(MulticastRequest request, int maxPacketSize, InvocationConstraints constraints) throws IOException
IOException
public MulticastRequest decodeMulticastRequest(DatagramPacket packet, InvocationConstraints constraints, ClientSubjectChecker checker) throws IOException
Discovery
MulticastRequest
instance that
contains the decoded data. null
constraints are considered
equivalent to empty constraints. All the specified constraints are
checked before this method returns.decodeMulticastRequest
in class Discovery
packet
- the packet to decodeconstraints
- the constraints to apply when decoding the packet, or
null
checker
- the object to use to check the client subject, or
null
IOException
- if an error occurs in interpreting the dataUnsupportedConstraintException
- if unable to satisfy the
specified constraintspublic EncodeIterator encodeMulticastAnnouncement(MulticastAnnouncement announcement, int maxPacketSize, InvocationConstraints constraints)
Discovery
DatagramPacket
s, each bounded in
length by the specified maximum packet size, in a manner that satisfies
the given constraints. null
constraints are considered
equivalent to empty constraints. The destination of each
DatagramPacket
produced by the returned iterator is set to
the address returned by
Constants.getAnnouncementAddress()
, with the
value of Constants.discoveryPort
used as the
destination port.encodeMulticastAnnouncement
in class Discovery
announcement
- the announcement data to encodemaxPacketSize
- the maximum size of packets to produceconstraints
- the constraints to apply when encoding the data, or
null
private static DatagramPacket[] encode(MulticastAnnouncement announcement, int maxPacketSize, InvocationConstraints constraints) throws IOException
IOException
public MulticastAnnouncement decodeMulticastAnnouncement(DatagramPacket packet, InvocationConstraints constraints) throws IOException
Discovery
MulticastAnnouncement
instance that contains the decoded data.
null
constraints are considered equivalent to empty
constraints. All the specified constraints are checked before this
method returns.decodeMulticastAnnouncement
in class Discovery
packet
- the packet to decodeconstraints
- the constraints to apply when decoding the packet, or
null
IOException
- if an error occurs in interpreting the dataUnsupportedConstraintException
- if unable to satisfy the
specified constraintspublic UnicastResponse doUnicastDiscovery(Socket socket, InvocationConstraints constraints, ClassLoader defaultLoader, ClassLoader verifierLoader, Collection context) throws IOException, ClassNotFoundException
Discovery
null
constraints are considered equivalent to empty
constraints.doUnicastDiscovery
in class Discovery
socket
- the socket on which to perform unicast discoveryconstraints
- the constraints to apply to unicast discovery, or
null
defaultLoader
- the class loader value (possibly null
)
to be passed as the defaultLoader
argument to
RMIClassLoader
methods when unmarshalling the registrar
proxyverifierLoader
- the class loader value (possibly
null
) to pass to Security.verifyCodebaseIntegrity
, if codebase integrity verification is
used when unmarshalling the registrar proxycontext
- the collection of context information objects (possibly
null
) to use when unmarshalling the registrar proxyIOException
- if an error occurs in interpreting received data or
in formatting data to sendUnsupportedConstraintException
- if unable to satisfy the
specified constraintsClassNotFoundException
- if the class of the discovered registrar
cannot be resolvedpublic void handleUnicastDiscovery(UnicastResponse response, Socket socket, InvocationConstraints constraints, ClientSubjectChecker checker, Collection context) throws IOException
Discovery
null
constraints are considered equivalent to empty
constraints.handleUnicastDiscovery
in class Discovery
response
- the unicast response data to transmitsocket
- the socket on which to handle unicast discoveryconstraints
- the constraints to apply to unicast discovery, or
null
checker
- the object to use to check the client subject, or
null
context
- the collection of context information objects to use when
marshalling the registrar proxyIOException
- if the protocol handshake fails, or if an error
occurs in interpreting received data or in formatting data to sendUnsupportedConstraintException
- if unable to satisfy the
specified constraintsprivate static void checkConstraints(InvocationConstraints constraints) throws UnsupportedConstraintException
UnsupportedConstraintException
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.