Class ResolveResult
- java.lang.Object
-
- org.apache.vinci.transport.FrameComponent
-
- org.apache.vinci.transport.Frame
-
- org.apache.vinci.transport.vns.client.ResolveResult
-
- All Implemented Interfaces:
Transportable
public class ResolveResult extends Frame
Specialized document (Frame) for representing the result of resolving a service name to host/port through VNS. Also provides utility methods for manipulating qualified/unqualified service names. This class is used by VinciClient to locate the physical location of the requested service from its logical service name.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResolveResult.ServiceLocator
-
Field Summary
Fields Modifier and Type Field Description static TransportableFactory
factory
int
priority
-
Constructor Summary
Constructors Constructor Description ResolveResult()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(String key, FrameComponent val)
Implement the frame add() callback.static Frame
composeQuery(String service_name)
Create a document representing the VNS resolve query for the specified service.static Frame
composeQuery(String service_name, int mypriority)
Create a document representing the VNS resolve query for the highest priority service(s) whose priority is strictly below the specified priority.Frame
createSubFrame(String key, int capacity)
Override the Frame createSubFrame method to create a ServiceLocator.ResolveResult.ServiceLocator
getNext()
Fetch the next service listing.boolean
hasMore()
Determine if there are more service listing to be fetched.void
initializeIterator()
Initialize the service listing iterator.static boolean
isQualified(String service_name)
Check whether a service_name has qualifications (that is, any or all of level, host, instance are explicitly specified.)static String
unqualifiedName(String service_name)
Strip the qualifications from this qualified service name.-
Methods inherited from class org.apache.vinci.transport.Frame
createFrameLeaf, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, fadd, faddTrueBinary, fromStream, getFrameTransporter, getKeyValuePair, getKeyValuePairCount, setFrameTransporter, toRawXML, toRawXML, toRawXMLWork, toStream, toString, toXML, toXML, toXML
-
Methods inherited from class org.apache.vinci.transport.FrameComponent
getAttributes, setAttributes
-
-
-
-
Field Detail
-
priority
public int priority
-
factory
public static TransportableFactory factory
-
-
Method Detail
-
unqualifiedName
public static String unqualifiedName(String service_name)
Strip the qualifications from this qualified service name.- Parameters:
service_name
- -- Returns:
- -
-
isQualified
public static boolean isQualified(String service_name)
Check whether a service_name has qualifications (that is, any or all of level, host, instance are explicitly specified.)- Parameters:
service_name
- -- Returns:
- -
-
composeQuery
public static Frame composeQuery(String service_name)
Create a document representing the VNS resolve query for the specified service. This method accepts either qualified or unqualified service names.- Parameters:
service_name
- -- Returns:
- -
-
composeQuery
public static Frame composeQuery(String service_name, int mypriority)
Create a document representing the VNS resolve query for the highest priority service(s) whose priority is strictly below the specified priority. This method accepts either qualified or unqualified service names.- Parameters:
service_name
- -mypriority
- -- Returns:
- -
-
initializeIterator
public void initializeIterator()
Initialize the service listing iterator. This initializes to a random spot to implement simple load balancing across multiple equivalent service instances.
-
hasMore
public boolean hasMore()
Determine if there are more service listing to be fetched.- Returns:
- -
-
getNext
public ResolveResult.ServiceLocator getNext()
Fetch the next service listing.- Returns:
- -
-
add
public void add(String key, FrameComponent val)
Implement the frame add() callback.
-
createSubFrame
public Frame createSubFrame(String key, int capacity)
Override the Frame createSubFrame method to create a ServiceLocator.- Overrides:
createSubFrame
in classFrame
- Parameters:
key
- -capacity
- -- Returns:
- the created sub-frame.
-
-