Author: david.lloyd(a)jboss.com
Date: 2010-03-16 14:36:20 -0400 (Tue, 16 Mar 2010)
New Revision: 5828
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Connection.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ConnectionImpl.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalConnectionHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceRegistrationInfo.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceRegistrationListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceURI.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundClient.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandlerContext.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple/LocalBasicExample2Main.java
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketProtocol.java
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketServiceConfiguration.java
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketUsageExamples.java
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/client/SocketClientConnectionHandler.java
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/server/SocketServerConnectionHandler.java
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/server/SocketServerRequestHandler.java
Log:
JBREM-1209 - Rename group name to instance name
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Connection.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Connection.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Connection.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -37,20 +37,20 @@
* Locate and open a client on the remote side of this connection.
*
* @param serviceType the service type
- * @param groupName the group name
+ * @param instanceName the instance name
* @param requestClass the request class
* @param replyClass the reply class
* @param <I> the request type
* @param <O> the reply type
* @return the future client
*/
- <I, O> IoFuture<? extends Client<I, O>> openClient(String
serviceType, String groupName, Class<I> requestClass, Class<O> replyClass);
+ <I, O> IoFuture<? extends Client<I, O>> openClient(String
serviceType, String instanceName, Class<I> requestClass, Class<O>
replyClass);
/**
* Locate and open a client on the remote side of this connection.
*
* @param serviceType the service type
- * @param groupName the group name
+ * @param instanceName the instance name
* @param requestClass the request class
* @param replyClass the reply class
* @param optionMap the option map
@@ -58,13 +58,13 @@
* @param <O> the reply type
* @return the future client
*/
- <I, O> IoFuture<? extends Client<I, O>> openClient(String
serviceType, String groupName, Class<I> requestClass, Class<O> replyClass,
OptionMap optionMap);
+ <I, O> IoFuture<? extends Client<I, O>> openClient(String
serviceType, String instanceName, Class<I> requestClass, Class<O> replyClass,
OptionMap optionMap);
/**
* Locate and open a client on the remote side of this connection.
*
* @param serviceType the service type
- * @param groupName the group name
+ * @param instanceName the instance name
* @param requestClass the request class
* @param replyClass the reply class
* @param classLoader the class loader to use to unmarshall incoming messages
@@ -73,7 +73,7 @@
* @param <O> the reply type
* @return the future client
*/
- <I, O> IoFuture<? extends Client<I, O>> openClient(String
serviceType, String groupName, Class<I> requestClass, Class<O> replyClass,
ClassLoader classLoader, OptionMap optionMap);
+ <I, O> IoFuture<? extends Client<I, O>> openClient(String
serviceType, String instanceName, Class<I> requestClass, Class<O> replyClass,
ClassLoader classLoader, OptionMap optionMap);
/**
* Create a client connector which may <b>only</b> transmitted to the
remote side of this connection, allowing
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ConnectionImpl.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ConnectionImpl.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ConnectionImpl.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -57,11 +57,11 @@
connectionHandler.close();
}
- public <I, O> IoFuture<? extends Client<I, O>> openClient(final
String serviceType, final String groupName, final Class<I> requestClass, final
Class<O> replyClass) {
- return openClient(serviceType, groupName, requestClass, replyClass,
OptionMap.EMPTY);
+ public <I, O> IoFuture<? extends Client<I, O>> openClient(final
String serviceType, final String instanceName, final Class<I> requestClass, final
Class<O> replyClass) {
+ return openClient(serviceType, instanceName, requestClass, replyClass,
OptionMap.EMPTY);
}
- public <I, O> IoFuture<? extends Client<I, O>> openClient(final
String serviceType, final String groupName, final Class<I> requestClass, final
Class<O> replyClass, final OptionMap optionMap) {
+ public <I, O> IoFuture<? extends Client<I, O>> openClient(final
String serviceType, final String instanceName, final Class<I> requestClass, final
Class<O> replyClass, final OptionMap optionMap) {
ClassLoader classLoader;
final SecurityManager sm = System.getSecurityManager();
if (sm == null) {
@@ -73,12 +73,12 @@
}
});
}
- return openClient(serviceType, groupName, requestClass, replyClass, classLoader,
optionMap);
+ return openClient(serviceType, instanceName, requestClass, replyClass,
classLoader, optionMap);
}
- public <I, O> IoFuture<? extends Client<I, O>> openClient(final
String serviceType, final String groupName, final Class<I> requestClass, final
Class<O> replyClass, final ClassLoader classLoader, final OptionMap optionMap) {
+ public <I, O> IoFuture<? extends Client<I, O>> openClient(final
String serviceType, final String instanceName, final Class<I> requestClass, final
Class<O> replyClass, final ClassLoader classLoader, final OptionMap optionMap) {
final FutureResult<Client<I, O>> futureResult = new
FutureResult<Client<I, O>>();
- futureResult.addCancelHandler(connectionHandler.open(serviceType, groupName, new
ClientWrapper<I, O>(endpoint, futureResult, requestClass, replyClass, classLoader),
classLoader, optionMap));
+ futureResult.addCancelHandler(connectionHandler.open(serviceType, instanceName,
new ClientWrapper<I, O>(endpoint, futureResult, requestClass, replyClass,
classLoader), classLoader, optionMap));
return futureResult.getIoFuture();
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -77,11 +77,11 @@
interface ServiceBuilder<I, O> {
/**
- * Set the group name.
- * @param groupName the group name
+ * Set the instance name.
+ * @param instanceName the instance name
* @return this builder
*/
- ServiceBuilder<I, O> setGroupName(String groupName);
+ ServiceBuilder<I, O> setInstanceName(String instanceName);
/**
* Set the service type string, which should follow the convention for package
names (reversed domain names).
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -234,7 +234,7 @@
}
private final class ServiceBuilderImpl<I, O> implements ServiceBuilder<I,
O> {
- private String groupName = "default";
+ private String instanceName = "default";
private String serviceType;
private Class<I> requestType;
private Class<O> replyType;
@@ -242,8 +242,8 @@
private ClassLoader classLoader;
private OptionMap optionMap = OptionMap.EMPTY;
- public ServiceBuilder<I, O> setGroupName(final String groupName) {
- this.groupName = groupName;
+ public ServiceBuilder<I, O> setInstanceName(final String instanceName) {
+ this.instanceName = instanceName;
return this;
}
@@ -300,8 +300,8 @@
if (sm != null) {
sm.checkPermission(REGISTER_SERVICE_PERM);
}
- if (groupName == null) {
- throw new IllegalArgumentException("groupName is null");
+ if (instanceName == null) {
+ throw new IllegalArgumentException("instanceName is null");
}
if (serviceType == null) {
throw new IllegalArgumentException("serviceType is null");
@@ -320,19 +320,19 @@
throw new IllegalArgumentException("metric must be greater than or
equal to zero");
}
ServiceURI.validateServiceType(serviceType);
- ServiceURI.validateGroupName(groupName);
+ ServiceURI.validateInstanceName(instanceName);
checkOpen();
Lock lock = serviceWriteLock;
lock.lock();
try {
- log.trace("Registering a service type '%s' group name
'%s'", serviceType, groupName);
+ log.trace("Registering a service type '%s' instance name
'%s'", serviceType, instanceName);
final String canonServiceType = serviceType.toLowerCase();
- final String canonGroupName = groupName.toLowerCase();
+ final String canonInstanceName = instanceName.toLowerCase();
final Executor executor = EndpointImpl.this.executor;
final ClassLoader classLoader = this.classLoader == null ?
clientListener.getClass().getClassLoader() : this.classLoader;
final Map<String, Map<String, ServiceRegistrationInfo>>
registeredLocalServices = localServiceIndex;
final RequestHandlerFactory<I, O> handlerFactory =
RequestHandlerFactory.create(executor, clientListener, requestType, replyType,
classLoader);
- final ServiceRegistrationInfo registration = new
ServiceRegistrationInfo(serviceType, groupName, name, optionMap, handlerFactory);
+ final ServiceRegistrationInfo registration = new
ServiceRegistrationInfo(serviceType, instanceName, name, optionMap, handlerFactory);
// this handle is used to remove the service registration
class ServiceRegistration extends
AbstractHandleableCloseable<Registration> implements Registration {
@@ -346,12 +346,12 @@
try {
final Map<String, ServiceRegistrationInfo> submap =
localServiceIndex.get(serviceType);
if (submap != null) {
- final ServiceRegistrationInfo oldReg =
submap.get(groupName);
+ final ServiceRegistrationInfo oldReg =
submap.get(instanceName);
if (oldReg == registration) {
- submap.remove(groupName);
+ submap.remove(instanceName);
}
}
- log.trace("Removed service type '%s' group name
'%s'", serviceType, groupName);
+ log.trace("Removed service type '%s' instance
name '%s'", serviceType, instanceName);
} finally {
lock.unlock();
}
@@ -371,14 +371,14 @@
final Map<String, ServiceRegistrationInfo> submap;
if (registeredLocalServices.containsKey(canonServiceType)) {
submap = registeredLocalServices.get(canonServiceType);
- if (submap.containsKey(canonGroupName)) {
- throw new ServiceRegistrationException("ListenerRegistration
of service of type \"" + serviceType + "\" in group \"" +
groupName + "\" duplicates an already-registered service's
specification");
+ if (submap.containsKey(canonInstanceName)) {
+ throw new ServiceRegistrationException("ListenerRegistration
of service of type \"" + serviceType + "\" in instance \"" +
instanceName + "\" duplicates an already-registered service's
specification");
}
} else {
submap = hashMap();
registeredLocalServices.put(canonServiceType, submap);
}
- submap.put(canonGroupName, registration);
+ submap.put(canonInstanceName, registration);
// downgrade safely to read lock
final Lock readLock = serviceReadLock;
//noinspection LockAcquiredButNotSafelyReleased
@@ -393,7 +393,7 @@
serviceListenerRegistrations =
EndpointImpl.this.serviceListenerRegistrations.entrySet().iterator();
// notify all service listener registrations that were registered at the
time the service was created
final ServiceRegistrationListener.ServiceInfo serviceInfo = new
ServiceRegistrationListener.ServiceInfo();
- serviceInfo.setGroupName(groupName);
+ serviceInfo.setInstanceName(instanceName);
serviceInfo.setServiceType(serviceType);
serviceInfo.setOptionMap(optionMap);
serviceInfo.setRegistrationHandle(handle);
@@ -507,7 +507,7 @@
serviceInfo.setRequestClass(handlerFactory.getRequestClass());
serviceInfo.setReplyClass(handlerFactory.getReplyClass());
serviceInfo.setServiceClassLoader(handlerFactory.getServiceClassLoader());
- serviceInfo.setGroupName(service.getGroupName());
+ serviceInfo.setInstanceName(service.getInstanceName());
serviceInfo.setOptionMap(service.getOptionMap());
serviceInfo.setRegistrationHandle(service.getHandle());
serviceInfo.setServiceType(service.getServiceType());
@@ -752,17 +752,17 @@
return connectionProviderContext;
}
- public LocalRequestHandler openService(final String serviceType, final String
groupName, final OptionMap optionMap) {
+ public LocalRequestHandler openService(final String serviceType, final String
instanceName, final OptionMap optionMap) {
final Lock lock = serviceReadLock;
lock.lock();
try {
final Map<String, ServiceRegistrationInfo> subMap =
localServiceIndex.get(serviceType);
final ServiceRegistrationInfo info;
- if (groupName == null || groupName.length() == 0 ||
"*".equals(groupName)) {
+ if (instanceName == null || instanceName.length() == 0 ||
"*".equals(instanceName)) {
final Iterator<ServiceRegistrationInfo> i =
subMap.values().iterator();
info = i.hasNext() ? i.next() : null;
} else {
- info = subMap == null ? null : subMap.get(groupName);
+ info = subMap == null ? null : subMap.get(instanceName);
}
if (info == null) {
return null;
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalConnectionHandler.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalConnectionHandler.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/LocalConnectionHandler.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -43,10 +43,10 @@
this.connectionOptionMap = connectionOptionMap;
}
- public Cancellable open(final String serviceType, final String groupName, final
Result<RemoteRequestHandler> result, final ClassLoader classLoader, final OptionMap
optionMap) {
- final LocalRequestHandler handler =
connectionHandlerContext.openService(serviceType, groupName, optionMap);
+ public Cancellable open(final String serviceType, final String instanceName, final
Result<RemoteRequestHandler> result, final ClassLoader classLoader, final OptionMap
optionMap) {
+ final LocalRequestHandler handler =
connectionHandlerContext.openService(serviceType, instanceName, optionMap);
if (handler == null) {
- result.setException(new
ServiceNotFoundException(ServiceURI.create(serviceType, groupName, null)));
+ result.setException(new
ServiceNotFoundException(ServiceURI.create(serviceType, instanceName, null)));
} else {
final LocalRemoteRequestHandler requestHandler = new
LocalRemoteRequestHandler(handler, classLoader, optionMap, connectionOptionMap,
connectionHandlerContext.getConnectionProviderContext().getExecutor());
result.setResult(requestHandler);
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceRegistrationInfo.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceRegistrationInfo.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceRegistrationInfo.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -30,23 +30,23 @@
final class ServiceRegistrationInfo {
private final String serviceType;
- private final String groupName;
+ private final String instanceName;
private final String endpointName;
private final OptionMap optionMap;
private final RequestHandlerFactory<?, ?> requestHandlerFactory;
private volatile Registration handle;
- ServiceRegistrationInfo(final String serviceType, final String groupName, final
String endpointName, final OptionMap optionMap, final RequestHandlerFactory<?, ?>
requestHandlerFactory) {
+ ServiceRegistrationInfo(final String serviceType, final String instanceName, final
String endpointName, final OptionMap optionMap, final RequestHandlerFactory<?, ?>
requestHandlerFactory) {
this.requestHandlerFactory = requestHandlerFactory;
this.serviceType = serviceType;
- this.groupName = groupName;
+ this.instanceName = instanceName;
this.endpointName = endpointName;
this.optionMap = optionMap;
}
- public boolean matches(final String serviceType, final String groupName, final String
endpointName) {
+ public boolean matches(final String serviceType, final String instanceName, final
String endpointName) {
return (serviceType == null || serviceType.length() == 0 ||
"*".equals(serviceType) || serviceType.equals(this.serviceType)) &&
- (groupName == null || groupName.length() == 0 ||
"*".equals(groupName) || groupName.equals(this.groupName)) &&
+ (instanceName == null || instanceName.length() == 0 ||
"*".equals(instanceName) || instanceName.equals(this.instanceName)) &&
(endpointName == null || endpointName.length() == 0 ||
"*".equals(endpointName) || endpointName.equals(this.endpointName));
}
@@ -54,8 +54,8 @@
return serviceType;
}
- public String getGroupName() {
- return groupName;
+ public String getInstanceName() {
+ return instanceName;
}
public String getEndpointName() {
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceRegistrationListener.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceRegistrationListener.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceRegistrationListener.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -47,7 +47,7 @@
*/
final class ServiceInfo implements Cloneable {
private String serviceType;
- private String groupName;
+ private String instanceName;
private ClassLoader serviceClassLoader;
private Class<?> requestClass;
private Class<?> replyClass;
@@ -79,21 +79,21 @@
}
/**
- * Get the group name.
+ * Get the instance name.
*
- * @return the group name
+ * @return the instance name
*/
- public String getGroupName() {
- return groupName;
+ public String getInstanceName() {
+ return instanceName;
}
/**
- * Set the group name.
+ * Set the instance name.
*
- * @param groupName the group name
+ * @param instanceName the instance name
*/
- public void setGroupName(final String groupName) {
- this.groupName = groupName;
+ public void setInstanceName(final String instanceName) {
+ this.instanceName = instanceName;
}
/**
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceURI.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceURI.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ServiceURI.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -70,29 +70,29 @@
}
/**
- * Get the group name from a Remoting service URI.
+ * Get the instance name from a Remoting service URI.
*
* @param uri the URI
- * @return the group name
+ * @return the instance name
* @throws IllegalArgumentException if the given URI is not for a remoting service
*/
- public static String getGroupName(final URI uri) throws IllegalArgumentException {
+ public static String getInstanceName(final URI uri) throws IllegalArgumentException
{
if (! isRemotingServiceUri(uri)) {
throw new IllegalArgumentException("Not a valid remoting service
URI");
}
final String ssp = uri.getSchemeSpecificPart();
final int firstColon = ssp.indexOf(':');
- final String groupName;
+ final String instanceName;
if (firstColon == -1) {
return "";
}
final int secondColon = ssp.indexOf(':', firstColon + 1);
if (secondColon == -1) {
- groupName = ssp.substring(firstColon + 1);
+ instanceName = ssp.substring(firstColon + 1);
} else {
- groupName = ssp.substring(firstColon + 1, secondColon);
+ instanceName = ssp.substring(firstColon + 1, secondColon);
}
- return groupName.toLowerCase();
+ return instanceName.toLowerCase();
}
/**
@@ -130,19 +130,19 @@
* Create a Remoting service URI.
*
* @param serviceType the service type, if any
- * @param groupName the group name, if any
+ * @param instanceName the instance name, if any
* @param endpointName the endpoint name, if any
* @return the URI
*/
- public static URI create(String serviceType, String groupName, String endpointName)
{
+ public static URI create(String serviceType, String instanceName, String
endpointName) {
try {
StringBuilder builder = new StringBuilder(32);
if (serviceType != null && serviceType.length() > 0) {
builder.append(serviceType);
}
builder.append(':');
- if (groupName != null && groupName.length() > 0) {
- builder.append(groupName);
+ if (instanceName != null && instanceName.length() > 0) {
+ builder.append(instanceName);
}
builder.append(':');
if (endpointName != null && endpointName.length() > 0) {
@@ -155,7 +155,7 @@
}
private static final Pattern VALID_SERVICE_TYPE =
Pattern.compile("^(?:[_a-z][_a-z0-9]*)(?:\\.[_a-z][_a-z0-9]*)*$",
Pattern.CASE_INSENSITIVE);
- private static final Pattern VALID_GROUP_NAME =
Pattern.compile("^(?:[_a-z0-9]+)(?:\\.[_a-z0-9]+)*$",
Pattern.CASE_INSENSITIVE);
+ private static final Pattern VALID_INSTANCE_NAME =
Pattern.compile("^(?:[_a-z0-9]+)(?:\\.[_a-z0-9]+)*$",
Pattern.CASE_INSENSITIVE);
private static final Pattern VALID_ENDPOINT_NAME = VALID_SERVICE_TYPE;
public static void validateServiceType(final CharSequence serviceType) {
@@ -167,12 +167,12 @@
}
}
- public static void validateGroupName(final CharSequence groupName) {
- if (groupName == null) {
- throw new NullPointerException("groupName is null");
+ public static void validateInstanceName(final CharSequence instanceName) {
+ if (instanceName == null) {
+ throw new NullPointerException("instanceName is null");
}
- if (! VALID_GROUP_NAME.matcher(groupName).matches()) {
- throw new IllegalArgumentException("Group name \"" + groupName
+ "\" is not valid");
+ if (! VALID_INSTANCE_NAME.matcher(instanceName).matches()) {
+ throw new IllegalArgumentException("Instance name \"" +
instanceName + "\" is not valid");
}
}
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundClient.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundClient.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundClient.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -34,16 +34,16 @@
private final int id;
private final String serviceType;
- private final String groupName;
+ private final String instanceName;
private RemoteConnectionHandler remoteConnectionHandler;
private RemoteRequestHandler requestHandler;
- OutboundClient(final RemoteConnectionHandler remoteConnectionHandler, final int id,
final Result<RemoteRequestHandler> result, final String serviceType, final String
groupName) {
+ OutboundClient(final RemoteConnectionHandler remoteConnectionHandler, final int id,
final Result<RemoteRequestHandler> result, final String serviceType, final String
instanceName) {
this.remoteConnectionHandler = remoteConnectionHandler;
this.id = id;
this.result = result;
this.serviceType = serviceType;
- this.groupName = groupName;
+ this.instanceName = instanceName;
}
State getState() {
@@ -77,8 +77,8 @@
return serviceType;
}
- String getGroupName() {
- return groupName;
+ String getInstanceName() {
+ return instanceName;
}
RemoteConnectionHandler getRemoteConnectionHandler() {
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -85,12 +85,12 @@
marshallingConfiguration = config;
}
- public Cancellable open(final String serviceType, final String groupName, final
Result<RemoteRequestHandler> result, final ClassLoader classLoader, final OptionMap
optionMap) {
+ public Cancellable open(final String serviceType, final String instanceName, final
Result<RemoteRequestHandler> result, final ClassLoader classLoader, final OptionMap
optionMap) {
final OutboundClient outboundClient;
int id;
synchronized (outboundClients) {
while (outboundClients.containsKey(id = random.nextInt() | 1));
- outboundClient = new OutboundClient(this, id, result, serviceType,
groupName);
+ outboundClient = new OutboundClient(this, id, result, serviceType,
instanceName);
outboundClients.put(id, outboundClient);
}
// compose & send message
@@ -101,7 +101,7 @@
buffer.putInt(id);
Buffers.putModifiedUtf8(buffer, serviceType);
buffer.put((byte) 0);
- Buffers.putModifiedUtf8(buffer, groupName);
+ Buffers.putModifiedUtf8(buffer, instanceName);
buffer.put((byte) 0);
final ByteOutput output = Marshalling.createByteOutput(buffer);
final Marshaller marshaller =
marshallerFactory.createMarshaller(marshallingConfiguration);
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -63,7 +63,7 @@
case RemoteProtocol.SERVICE_REQUEST: {
final int id = buffer.getInt();
final String serviceType = Buffers.getModifiedUtf8Z(buffer);
- final String groupName = Buffers.getModifiedUtf8Z(buffer);
+ final String instanceName = Buffers.getModifiedUtf8Z(buffer);
final Pool<ByteBuffer> bufferPool =
connectionHandler.getBufferPool();
final ByteInput input = Marshalling.createByteInput(buffer);
final OptionMap optionMap;
@@ -93,7 +93,7 @@
return;
}
final LocalRequestHandler handler;
- handler =
connectionHandler.getConnectionContext().openService(serviceType, groupName, optionMap);
+ handler =
connectionHandler.getConnectionContext().openService(serviceType, instanceName,
optionMap);
outBuf.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
if (handler == null) {
// no matching service found
@@ -134,7 +134,7 @@
}
synchronized (client) {
// todo assert client state == waiting
- client.getResult().setException(new
ServiceNotFoundException(ServiceURI.create(client.getServiceType(), client.getGroupName(),
null)));
+ client.getResult().setException(new
ServiceNotFoundException(ServiceURI.create(client.getServiceType(),
client.getInstanceName(), null)));
client.setState(OutboundClient.State.CLOSED);
}
return;
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandler.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandler.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandler.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -36,13 +36,13 @@
* Open a request handler.
*
* @param serviceType the service type string
- * @param groupName the group name string
+ * @param instanceName the instance name string
* @param result the result for the connected request handler
* @param classLoader the class loader to use for replies
* @param optionMap the options for this service
* @return a handle which may be used to cancel the pending operation
*/
- Cancellable open(String serviceType, String groupName,
Result<RemoteRequestHandler> result, ClassLoader classLoader, OptionMap optionMap);
+ Cancellable open(String serviceType, String instanceName,
Result<RemoteRequestHandler> result, ClassLoader classLoader, OptionMap optionMap);
/**
* Create a connector which may be used to communicate with the given local
RequestHandler. The connector
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandlerContext.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandlerContext.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandlerContext.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -45,12 +45,12 @@
* @remoting.nonblocking
*
* @param serviceType the service type string
- * @param groupName the group name, or {@code null} for any group name
+ * @param instanceName the instance name, or {@code null} for any instance name
* @param optionMap the options to pass to the service
* @return the new request handler
* @throws IOException if an error occurs
*/
- LocalRequestHandler openService(String serviceType, String groupName, OptionMap
optionMap);
+ LocalRequestHandler openService(String serviceType, String instanceName, OptionMap
optionMap);
/**
* Indicate that the remote side has terminated the connection, so the local side
should be closed as well.
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -93,7 +93,7 @@
try {
final InvocationTestObject requestObj = new InvocationTestObject();
final InvocationTestObject replyObj = new InvocationTestObject();
- final Registration registration =
endpoint.serviceBuilder().setGroupName("foo").setServiceType("test1").setRequestType(InvocationTestObject.class).
+ final Registration registration =
endpoint.serviceBuilder().setInstanceName("foo").setServiceType("test1").setRequestType(InvocationTestObject.class).
setReplyType(InvocationTestObject.class).setClientListener(new
ClientListener<InvocationTestObject, InvocationTestObject>() {
public RequestListener<InvocationTestObject, InvocationTestObject>
handleClientOpen(final ClientContext clientContext, final OptionMap optionMap) {
clientContext.addCloseHandler(new CloseHandler<ClientContext>()
{
@@ -141,7 +141,7 @@
try {
final InvocationTestObject requestObj = new InvocationTestObject();
final InvocationTestObject replyObj = new InvocationTestObject();
- final Registration registration =
endpoint.serviceBuilder().setGroupName("foo").setServiceType("test2").setRequestType(InvocationTestObject.class).
+ final Registration registration =
endpoint.serviceBuilder().setInstanceName("foo").setServiceType("test2").setRequestType(InvocationTestObject.class).
setReplyType(InvocationTestObject.class).setClientListener(new
ClientListener<InvocationTestObject, InvocationTestObject>() {
public RequestListener<InvocationTestObject, InvocationTestObject>
handleClientOpen(final ClientContext clientContext, final OptionMap optionMap) {
clientContext.addCloseHandler(new CloseHandler<ClientContext>()
{
@@ -191,7 +191,7 @@
final InvocationTestObject requestObj = new InvocationTestObject();
final InvocationTestObject replyObj = new InvocationTestObject();
- final Registration registration =
endpoint.serviceBuilder().setGroupName("foo").setServiceType("test3").setRequestType(ClientConnector.class).
+ final Registration registration =
endpoint.serviceBuilder().setInstanceName("foo").setServiceType("test3").setRequestType(ClientConnector.class).
setReplyType(InvocationTestObject.class).setClientListener(new
ClientListener<ClientConnector, InvocationTestObject>() {
public RequestListener<ClientConnector, InvocationTestObject>
handleClientOpen(final ClientContext clientContext, final OptionMap optionMap) {
clientContext.addCloseHandler(new CloseHandler<ClientContext>()
{
@@ -280,7 +280,7 @@
try {
final OptionMap optionMap = OptionMap.builder().set(Options.BROADCAST,
true).getMap();
final AtomicReference<OptionMap> receivedOptions = new
AtomicReference<OptionMap>();
- final Registration registration =
endpoint.serviceBuilder().setGroupName("foo").setServiceType("test1").setRequestType(InvocationTestObject.class).
+ final Registration registration =
endpoint.serviceBuilder().setInstanceName("foo").setServiceType("test1").setRequestType(InvocationTestObject.class).
setReplyType(InvocationTestObject.class).setClientListener(new
ClientListener<InvocationTestObject, InvocationTestObject>() {
public RequestListener<InvocationTestObject, InvocationTestObject>
handleClientOpen(final ClientContext clientContext, final OptionMap optionMap) {
receivedOptions.set(optionMap);
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple/LocalBasicExample2Main.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple/LocalBasicExample2Main.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/simple/LocalBasicExample2Main.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -42,7 +42,7 @@
public static void main(String[] args) throws Exception {
final Endpoint endpoint = Remoting.getConfiguredEndpoint();
try {
- final Registration handle =
endpoint.serviceBuilder().setServiceType("simple.rot13").setGroupName("main")
+ final Registration handle =
endpoint.serviceBuilder().setServiceType("simple.rot13").setInstanceName("main")
.setRequestType(String.class).setReplyType(String.class).setClientListener(new
StringRot13ClientListener())
.register();
try {
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketProtocol.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketProtocol.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketProtocol.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -97,14 +97,14 @@
@SuppressWarnings("unchecked")
static public <I, O> void startService(Endpoint endpoint, Executor executor,
SocketServiceConfiguration<I, O> socketConfig, final RequestListener<I, O>
requestListener) throws IOException {
String serviceType = socketConfig.getServiceType();
- String groupName = socketConfig.getGroupName();
+ String instanceName = socketConfig.getInstanceName();
ClientListener<I, O> clientListener = new SocketClientListener<I,
O>(endpoint, socketConfig, requestListener);
ServiceBuilder<I, O> sb = (ServiceBuilder<I, O>)
endpoint.serviceBuilder();
sb.setRequestType(socketConfig.getRequestClass());
sb.setReplyType(socketConfig.getResponseClass());
sb.setClientListener(clientListener);
sb.setServiceType(serviceType);
- sb.setGroupName(groupName);
+ sb.setInstanceName(instanceName);
sb.register();
}
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketServiceConfiguration.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketServiceConfiguration.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketServiceConfiguration.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -30,15 +30,15 @@
*/
public class SocketServiceConfiguration<I, O> {
private String serviceType;
- private String groupName;
+ private String instanceName;
private Class<I> requestClass;
private Class<O> responseClass;
private String host;
private int port;
- public SocketServiceConfiguration(String serviceType, String groupName, Class<I>
requestClass, Class<O> responseClass, String host, int port) {
+ public SocketServiceConfiguration(String serviceType, String instanceName,
Class<I> requestClass, Class<O> responseClass, String host, int port) {
this.serviceType = serviceType;
- this.groupName = groupName;
+ this.instanceName = instanceName;
this.requestClass = requestClass;
this.responseClass = responseClass;
this.host = host;
@@ -53,12 +53,12 @@
this.serviceType = serviceType;
}
- public String getGroupName() {
- return groupName;
+ public String getInstanceName() {
+ return instanceName;
}
- public void setGroupName(String groupName) {
- this.groupName = groupName;
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
}
public Class<I> getRequestClass() {
@@ -94,7 +94,7 @@
}
public String toString() {
- return "[serviceType=" + serviceType + ", groupName=" +
groupName + "requestClass=" + requestClass + ", responseClass= " +
responseClass + ", host=" + host + ", port=" + port + "]";
+ return "[serviceType=" + serviceType + ", instanceName=" +
instanceName + "requestClass=" + requestClass + ", responseClass= " +
responseClass + ", host=" + host + ", port=" + port + "]";
}
}
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketUsageExamples.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketUsageExamples.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/SocketUsageExamples.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -60,13 +60,12 @@
private static final String DR_FRANKENSTEIN_REQUEST = "Dr. Frankenstein?";
private static final String DR_FRANKENSTEIN_RESPONSE = "It's
Frankenshteen!";
private static final String SERVICE_TYPE = "testservice";
- private static final String GROUP_NAME = "testgroup";
+ private static final String INSTANCE_NAME = "testinstance";
private static final String HOST = "localhost";
private static final int PORT = 6789;
private static int portCounter;
-
- /**
+ /**
* Sends a message and gets a result, using Client.send().
*
* @throws Exception
@@ -78,7 +77,7 @@
Endpoint serverEndpoint = Remoting.createEndpoint("server",
serverExecutor, OptionMap.EMPTY);
int serverPort = PORT + portCounter++;
Cancellable socketServer = SocketProtocol.registerServerTransport(serverEndpoint,
serverExecutor, HOST, serverPort);
- SocketServiceConfiguration<String, String> socketServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE, GROUP_NAME, String.class,
String.class, HOST, serverPort);
+ SocketServiceConfiguration<String, String> socketServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE, INSTANCE_NAME,
String.class, String.class, HOST, serverPort);
SocketProtocol.startService(serverEndpoint, serverExecutor,
socketServiceConfiguration, new DrNickRequestListener());
// Create client and connect to server.
@@ -86,7 +85,7 @@
Endpoint clientEndpoint = Remoting.createEndpoint("client",
serverExecutor, OptionMap.EMPTY);
SocketProtocol.registerClientTransport(clientEndpoint, clientExecutor, HOST);
Connection connection = getFutureResult(clientEndpoint.connect(new
URI("socket://" + HOST + ":" + serverPort), OptionMap.EMPTY),
"couldn't create Connection");
- Client<String, String> client =
getFutureResult(connection.openClient(SERVICE_TYPE, GROUP_NAME, String.class,
String.class), "couldn't create Client");
+ Client<String, String> client =
getFutureResult(connection.openClient(SERVICE_TYPE, INSTANCE_NAME, String.class,
String.class), "couldn't create Client");
// Send message and get response.
String response = getFutureResult(client.send(DR_NICK_REQUEST), "couldn't
get response");
@@ -114,7 +113,7 @@
Endpoint serverEndpoint = Remoting.createEndpoint("server",
serverExecutor, OptionMap.EMPTY);
int serverPort = PORT + portCounter++;
Cancellable socketServer = SocketProtocol.registerServerTransport(serverEndpoint,
serverExecutor, HOST, serverPort);
- SocketServiceConfiguration<String, String> socketServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE, GROUP_NAME, String.class,
String.class, HOST, serverPort);
+ SocketServiceConfiguration<String, String> socketServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE, INSTANCE_NAME,
String.class, String.class, HOST, serverPort);
SocketProtocol.startService(serverEndpoint, serverExecutor,
socketServiceConfiguration, new DrNickRequestListener());
// Create client and connect to server.
@@ -122,7 +121,7 @@
Endpoint clientEndpoint = Remoting.createEndpoint("client",
serverExecutor, OptionMap.EMPTY);
SocketProtocol.registerClientTransport(clientEndpoint, clientExecutor, HOST);
Connection connection = getFutureResult(clientEndpoint.connect(new
URI("socket://" + HOST + ":" + serverPort), OptionMap.EMPTY),
"couldn't create Connection");
- Client<String, String> client =
getFutureResult(connection.openClient(SERVICE_TYPE, GROUP_NAME, String.class,
String.class), "couldn't create Client");
+ Client<String, String> client =
getFutureResult(connection.openClient(SERVICE_TYPE, INSTANCE_NAME, String.class,
String.class), "couldn't create Client");
// Send message and get response.
String response = client.invoke(DR_NICK_REQUEST);
@@ -150,7 +149,7 @@
Endpoint westernEndpoint = Remoting.createEndpoint("west coast server",
westernExecutor, OptionMap.EMPTY);
int westernPort = PORT + portCounter++;
Cancellable westernServer = SocketProtocol.registerServerTransport(westernEndpoint,
westernExecutor, HOST, westernPort);
- SocketServiceConfiguration<String, String> westernServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE, GROUP_NAME, String.class,
String.class, HOST, westernPort);
+ SocketServiceConfiguration<String, String> westernServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE, INSTANCE_NAME,
String.class, String.class, HOST, westernPort);
SocketProtocol.startService(westernEndpoint, westernExecutor,
westernServiceConfiguration, new DrNickRequestListener());
// Start east coast service.
@@ -158,12 +157,12 @@
Endpoint easternEndpoint = Remoting.createEndpoint("west coast server",
easternExecutor, OptionMap.EMPTY);
int easternPort = PORT + portCounter++;
Cancellable easternServer = SocketProtocol.registerServerTransport(easternEndpoint,
easternExecutor, HOST, easternPort);
- SocketServiceConfiguration<String, String> easternServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE, GROUP_NAME, String.class,
String.class, HOST, easternPort);
+ SocketServiceConfiguration<String, String> easternServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE, INSTANCE_NAME,
String.class, String.class, HOST, easternPort);
SocketProtocol.startService(easternEndpoint, easternExecutor,
easternServiceConfiguration, new DrNickRequestListener());
// Send message east to west and get response.
Connection eastWestConnection = getFutureResult(easternEndpoint.connect(new
URI("socket://" + HOST + ":" + westernPort), OptionMap.EMPTY),
"couldn't create Connection");
- Client<String, String> eastWestClient =
getFutureResult(eastWestConnection.openClient(SERVICE_TYPE, GROUP_NAME, String.class,
String.class), "couldn't create Client");
+ Client<String, String> eastWestClient =
getFutureResult(eastWestConnection.openClient(SERVICE_TYPE, INSTANCE_NAME, String.class,
String.class), "couldn't create Client");
String response = getFutureResult(eastWestClient.send(DR_NICK_REQUEST),
"couldn't get response from west coast");
assertEquals(DR_NICK_RESPONSE, response);
log.info("EAST to WEST PASSES");
@@ -173,7 +172,7 @@
// Send message east to west and get response.
Connection westEastConnection = getFutureResult(westernEndpoint.connect(new
URI("socket://" + HOST + ":" + easternPort), OptionMap.EMPTY),
"couldn't create Connection");
- Client<String, String> westEastClient =
getFutureResult(westEastConnection.openClient(SERVICE_TYPE, GROUP_NAME, String.class,
String.class), "couldn't create Client");
+ Client<String, String> westEastClient =
getFutureResult(westEastConnection.openClient(SERVICE_TYPE, INSTANCE_NAME, String.class,
String.class), "couldn't create Client");
response = getFutureResult(westEastClient.send(DR_NICK_REQUEST), "couldn't
get response from east coast");
assertEquals(DR_NICK_RESPONSE, response);
log.info("WEST to EAST PASSES");
@@ -208,11 +207,11 @@
Cancellable socketServer = SocketProtocol.registerServerTransport(serverEndpoint,
serverExecutor, HOST, serverPort);
// Start first service.
- SocketServiceConfiguration<String, String> socketServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE + "1", GROUP_NAME,
String.class, String.class, HOST, serverPort);
+ SocketServiceConfiguration<String, String> socketServiceConfiguration = new
SocketServiceConfiguration<String, String>(SERVICE_TYPE + "1",
INSTANCE_NAME, String.class, String.class, HOST, serverPort);
SocketProtocol.startService(serverEndpoint, serverExecutor,
socketServiceConfiguration, new DrNickRequestListener());
// Start second service.
- socketServiceConfiguration = new SocketServiceConfiguration<String,
String>(SERVICE_TYPE + "2", GROUP_NAME, String.class, String.class, HOST,
serverPort);
+ socketServiceConfiguration = new SocketServiceConfiguration<String,
String>(SERVICE_TYPE + "2", INSTANCE_NAME, String.class, String.class, HOST,
serverPort);
SocketProtocol.startService(serverEndpoint, serverExecutor,
socketServiceConfiguration, new DrFrankensteinRequestListener());
// Create client endpoint and get connection.
@@ -222,12 +221,12 @@
Connection connection = getFutureResult(clientEndpoint.connect(new
URI("socket://" + HOST + ":" + serverPort), OptionMap.EMPTY),
"couldn't create Connection");
// Send message to first service and get response.
- Client<String, String> client1 =
getFutureResult(connection.openClient(SERVICE_TYPE + "1", GROUP_NAME,
String.class, String.class), "couldn't create Client");
+ Client<String, String> client1 =
getFutureResult(connection.openClient(SERVICE_TYPE + "1", INSTANCE_NAME,
String.class, String.class), "couldn't create Client");
String response = getFutureResult(client1.send(DR_NICK_REQUEST), "couldn't
get response");
assertEquals(DR_NICK_RESPONSE, response);
// Send message to second service and get response.
- Client<String, String> client2 =
getFutureResult(connection.openClient(SERVICE_TYPE + "2", GROUP_NAME,
String.class, String.class), "couldn't create Client");
+ Client<String, String> client2 =
getFutureResult(connection.openClient(SERVICE_TYPE + "2", INSTANCE_NAME,
String.class, String.class), "couldn't create Client");
response = getFutureResult(client2.send(DR_FRANKENSTEIN_REQUEST),
"couldn't get response");
assertEquals(DR_FRANKENSTEIN_RESPONSE, response);
@@ -255,7 +254,7 @@
Endpoint remoteEndpoint = Remoting.createEndpoint("remote endpoint",
remoteExecutor, OptionMap.EMPTY);
int remotePort = PORT + portCounter++;
Cancellable remoteServer = SocketProtocol.registerServerTransport(remoteEndpoint,
remoteExecutor, HOST, remotePort);
- SocketServiceConfiguration<RequestWrapper, Object> remoteServiceConfiguration
= new SocketServiceConfiguration<RequestWrapper, Object>(SERVICE_TYPE +
"remote", GROUP_NAME, RequestWrapper.class, Object.class, HOST, remotePort);
+ SocketServiceConfiguration<RequestWrapper, Object> remoteServiceConfiguration
= new SocketServiceConfiguration<RequestWrapper, Object>(SERVICE_TYPE +
"remote", INSTANCE_NAME, RequestWrapper.class, Object.class, HOST, remotePort);
SocketProtocol.startService(remoteEndpoint, remoteExecutor,
remoteServiceConfiguration, new CallbackSenderRequestListenerURI(remoteEndpoint));
// Start local service.
@@ -263,17 +262,17 @@
Endpoint localEndpoint = Remoting.createEndpoint("local server",
localExecutor, OptionMap.EMPTY);
int localPort = PORT + portCounter++;
Cancellable localServer = SocketProtocol.registerServerTransport(localEndpoint,
localExecutor, HOST, localPort);
- SocketServiceConfiguration<Object, Object> localServiceConfiguration = new
SocketServiceConfiguration<Object, Object>(SERVICE_TYPE + "local",
GROUP_NAME, Object.class, Object.class, HOST, localPort);
+ SocketServiceConfiguration<Object, Object> localServiceConfiguration = new
SocketServiceConfiguration<Object, Object>(SERVICE_TYPE + "local",
INSTANCE_NAME, Object.class, Object.class, HOST, localPort);
CallbackReceiverRequestListener callbackReceiver = new
CallbackReceiverRequestListener();
SocketProtocol.startService(localEndpoint, localExecutor,
localServiceConfiguration, callbackReceiver);
// Send message to remote server and get callbacks.
Connection connection = getFutureResult(localEndpoint.connect(new
URI("socket://" + HOST + ":" + remotePort), OptionMap.EMPTY),
"couldn't create Connection");
- Client<Object, RequestWrapper> client =
getFutureResult(connection.openClient(SERVICE_TYPE + "remote", GROUP_NAME,
Object.class, RequestWrapper.class), "couldn't create Client");
+ Client<Object, RequestWrapper> client =
getFutureResult(connection.openClient(SERVICE_TYPE + "remote", INSTANCE_NAME,
Object.class, RequestWrapper.class), "couldn't create Client");
RequestWrapper wrapper = new RequestWrapper();
wrapper.setUrl("socket://" + HOST + ":" + localPort);
wrapper.setServiceType(SERVICE_TYPE + "local");
- wrapper.setGroupName(GROUP_NAME);
+ wrapper.setInstanceName(INSTANCE_NAME);
wrapper.setPayload("callback");
client.send(wrapper);
Object callback = callbackReceiver.getNext();
@@ -306,7 +305,7 @@
Endpoint remoteEndpoint = Remoting.createEndpoint("remote endpoint",
remoteExecutor, OptionMap.EMPTY);
int remotePort = PORT + portCounter++;
Cancellable remoteServer = SocketProtocol.registerServerTransport(remoteEndpoint,
remoteExecutor, HOST, remotePort);
- SocketServiceConfiguration<Object, Object> remoteServiceConfiguration = new
SocketServiceConfiguration<Object, Object>(SERVICE_TYPE + "remote",
GROUP_NAME, Object.class, Object.class, HOST, remotePort);
+ SocketServiceConfiguration<Object, Object> remoteServiceConfiguration = new
SocketServiceConfiguration<Object, Object>(SERVICE_TYPE + "remote",
INSTANCE_NAME, Object.class, Object.class, HOST, remotePort);
SocketProtocol.startService(remoteEndpoint, remoteExecutor,
remoteServiceConfiguration, new CallbackSenderRequestListenerClientConnector());
// Create local endpoint.
@@ -316,7 +315,7 @@
// Send ClientConnector to remote server and get callbacks.
Connection connection = getFutureResult(localEndpoint.connect(new
URI("socket://" + HOST + ":" + remotePort), OptionMap.EMPTY),
"couldn't create Connection");
- Client<Object, Object> client =
getFutureResult(connection.openClient(SERVICE_TYPE + "remote", GROUP_NAME,
Object.class, Object.class), "couldn't create Client");
+ Client<Object, Object> client =
getFutureResult(connection.openClient(SERVICE_TYPE + "remote", INSTANCE_NAME,
Object.class, Object.class), "couldn't create Client");
CallbackReceiverRequestListener callbackReceiver = new
CallbackReceiverRequestListener();
ClientConnector<Object, Object> clientConnector =
connection.createClientConnector(callbackReceiver, Object.class, Object.class);
assertEquals("OK", client.invoke(clientConnector));
@@ -395,9 +394,10 @@
private static final long serialVersionUID = 1L;
private String url;
private String serviceType;
- private String groupName;
+ private String instanceName;
private Object payload;
- public String getUrl() {
+
+ public String getUrl() {
return url;
}
public void setUrl(String url) {
@@ -409,11 +409,11 @@
public void setServiceType(String serviceType) {
this.serviceType = serviceType;
}
- public String getGroupName() {
- return groupName;
+ public String getInstanceName() {
+ return instanceName;
}
- public void setGroupName(String groupName) {
- this.groupName = groupName;
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
}
public Object getPayload() {
return payload;
@@ -437,7 +437,7 @@
Client<Object, Object> client = null;
try {
connection = getFutureResult(endpoint.connect(new URI(request.getUrl()),
OptionMap.EMPTY), "couldn't create Connection");
- client = getFutureResult(connection.openClient(request.getServiceType(),
request.getGroupName(), Object.class, Object.class), "couldn't create
Client");
+ client = getFutureResult(connection.openClient(request.getServiceType(),
request.getInstanceName(), Object.class, Object.class), "couldn't create
Client");
log.info(this + " got client: " + client);
client.send(request.payload);
log.info(this + ": sent callback");
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/client/SocketClientConnectionHandler.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/client/SocketClientConnectionHandler.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/client/SocketClientConnectionHandler.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -77,7 +77,7 @@
}
}
- public Cancellable open(final String serviceType, final String groupName,
Result<RemoteRequestHandler> result, final ClassLoader classLoader, final OptionMap
optionMap) {
+ public Cancellable open(final String serviceType, final String instanceName,
Result<RemoteRequestHandler> result, final ClassLoader classLoader, final OptionMap
optionMap) {
try
{
final Socket socket = new Socket(remoteHost, remotePort);
@@ -88,7 +88,7 @@
final Unmarshaller unmarshaller = factory.createUnmarshaller(configuration);
marshaller.start(Marshalling.createByteOutput(socket.getOutputStream()));
marshaller.writeUTF(serviceType);
- marshaller.writeUTF(groupName);
+ marshaller.writeUTF(instanceName);
marshaller.flush();
unmarshaller.start(Marshalling.createByteInput(socket.getInputStream()));
result.setResult(new SocketClientRequestHandler(getExecutor(), marshaller,
unmarshaller));
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/server/SocketServerConnectionHandler.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/server/SocketServerConnectionHandler.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/server/SocketServerConnectionHandler.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -112,7 +112,7 @@
}
@Override
- public Cancellable open(final String serviceType, final String groupName,
Result<RemoteRequestHandler> result, final ClassLoader classLoader, final OptionMap
optionMap) {
+ public Cancellable open(final String serviceType, final String instanceName,
Result<RemoteRequestHandler> result, final ClassLoader classLoader, final OptionMap
optionMap) {
return null;
}
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/server/SocketServerRequestHandler.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/server/SocketServerRequestHandler.java 2010-03-12
17:58:31 UTC (rev 5827)
+++
remoting3/trunk/samples/src/main/java/org/jboss/remoting3/samples/socket/server/SocketServerRequestHandler.java 2010-03-16
18:36:20 UTC (rev 5828)
@@ -76,11 +76,11 @@
unmarshaller = factory.createUnmarshaller(configuration);
unmarshaller.start(Marshalling.createByteInput(socket.getInputStream()));
final String serviceType = unmarshaller.readUTF();
- final String groupName = unmarshaller.readUTF();
+ final String instanceName = unmarshaller.readUTF();
final RequestHandlerFuture requestHandlerFuture = new RequestHandlerFuture();
- final LocalRequestHandler requestHandler =
connectionHandlerContext.openService(serviceType, groupName, OptionMap.EMPTY);
+ final LocalRequestHandler requestHandler =
connectionHandlerContext.openService(serviceType, instanceName, OptionMap.EMPTY);
if (requestHandler == null) {
- requestHandlerFuture.setException(new
ServiceNotFoundException(ServiceURI.create(serviceType, groupName, null)));
+ requestHandlerFuture.setException(new
ServiceNotFoundException(ServiceURI.create(serviceType, instanceName, null)));
} else {
// requestHandlerFuture.setResult(requestHandler);
requestHandlerFuture.setResult(null);