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
DatagramPackets, 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
DatagramPackets, 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, getProtocol2private 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)
DiscoveryDatagramPackets, 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 Discoveryrequest - the request data to encodemaxPacketSize - the maximum size of packets to produceconstraints - the constraints to apply when encoding the data, or
nullprivate static DatagramPacket[] encode(MulticastRequest request, int maxPacketSize, InvocationConstraints constraints) throws IOException
IOExceptionpublic MulticastRequest decodeMulticastRequest(DatagramPacket packet, InvocationConstraints constraints, ClientSubjectChecker checker) throws IOException
DiscoveryMulticastRequest 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 Discoverypacket - the packet to decodeconstraints - the constraints to apply when decoding the packet, or
nullchecker - the object to use to check the client subject, or
nullIOException - if an error occurs in interpreting the dataUnsupportedConstraintException - if unable to satisfy the
specified constraintspublic EncodeIterator encodeMulticastAnnouncement(MulticastAnnouncement announcement, int maxPacketSize, InvocationConstraints constraints)
DiscoveryDatagramPackets, 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 Discoveryannouncement - the announcement data to encodemaxPacketSize - the maximum size of packets to produceconstraints - the constraints to apply when encoding the data, or
nullprivate static DatagramPacket[] encode(MulticastAnnouncement announcement, int maxPacketSize, InvocationConstraints constraints) throws IOException
IOExceptionpublic MulticastAnnouncement decodeMulticastAnnouncement(DatagramPacket packet, InvocationConstraints constraints) throws IOException
DiscoveryMulticastAnnouncement 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 Discoverypacket - the packet to decodeconstraints - the constraints to apply when decoding the packet, or
nullIOException - 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
Discoverynull constraints are considered equivalent to empty
constraints.doUnicastDiscovery in class Discoverysocket - the socket on which to perform unicast discoveryconstraints - the constraints to apply to unicast discovery, or
nulldefaultLoader - 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
Discoverynull constraints are considered equivalent to empty
constraints.handleUnicastDiscovery in class Discoveryresponse - the unicast response data to transmitsocket - the socket on which to handle unicast discoveryconstraints - the constraints to apply to unicast discovery, or
nullchecker - the object to use to check the client subject, or
nullcontext - 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
UnsupportedConstraintExceptionCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.