com.metamatrix.platform.service.proxy
Class ServiceProxy

java.lang.Object
  extended by com.metamatrix.platform.service.proxy.ServiceProxy
All Implemented Interfaces:
java.lang.reflect.InvocationHandler
Direct Known Subclasses:
MultipleInvokationProxy, SingleInvokationProxy

public abstract class ServiceProxy
extends java.lang.Object
implements java.lang.reflect.InvocationHandler

Provides common functionality for all service proxies.
Proxies for a given type of service extend this class and provide the required implementation.


Field Summary
protected static int MAX_RETRY_DELAY_VAL
           
 
Constructor Summary
ServiceProxy(java.lang.String serviceType)
           
 
Method Summary
protected  java.util.List<ServiceRegistryBinding> getInstances()
          Get the list of service instances from the given service selection policy.
protected  ServiceRegistryBinding getNextInstance()
          Get the next service instance from the given service selection policy.
 int getRetryLimit()
           
 java.lang.String getServiceType()
          Returns the service type that this proxy proxies for.
 boolean getStickyFlag()
           
protected  void logException(java.lang.Throwable e)
          Log an exception.
 void setRetryLimit(int retryLimit)
           
 void setServiceSelectionPolicy(ServiceSelectionPolicy policy)
          Set the ServiceSelectionPolicy that this proxy will use to select service instances for its lifetime.
 void setStickyFlag(boolean sticky)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.reflect.InvocationHandler
invoke
 

Field Detail

MAX_RETRY_DELAY_VAL

protected static final int MAX_RETRY_DELAY_VAL
See Also:
Constant Field Values
Constructor Detail

ServiceProxy

public ServiceProxy(java.lang.String serviceType)
Method Detail

getServiceType

public java.lang.String getServiceType()
Returns the service type that this proxy proxies for.

Returns:
The proxy's service type.

setServiceSelectionPolicy

public void setServiceSelectionPolicy(ServiceSelectionPolicy policy)
Set the ServiceSelectionPolicy that this proxy will use to select service instances for its lifetime.

Parameters:
policy - The ServiceSelectionPolicy to use.

getNextInstance

protected ServiceRegistryBinding getNextInstance()
                                          throws ServiceNotFoundException
Get the next service instance from the given service selection policy.

Returns:
The ServiceRegistryBinding for the next instance after being operated on by the selection policy.
Throws:
ServiceNotFoundException

getInstances

protected java.util.List<ServiceRegistryBinding> getInstances()
                                                       throws ServiceNotFoundException
Get the list of service instances from the given service selection policy.

Returns:
The ServiceRegistryBinding for the next instance after being operated on by the selection policy.
Throws:
ServiceNotFoundException

getRetryLimit

public int getRetryLimit()

setRetryLimit

public void setRetryLimit(int retryLimit)

logException

protected final void logException(java.lang.Throwable e)
Log an exception. Subclassers can override and provide a more service-specific logging mechanism if desired.


getStickyFlag

public boolean getStickyFlag()
See Also:
com.metamatrix.platform.service.proxy.ServiceProxyInterface#getStickyFlag()

setStickyFlag

public void setStickyFlag(boolean sticky)
See Also:
com.metamatrix.platform.service.proxy.ServiceProxyInterface#setStickyFlag(boolean)


Copyright © 2009. All Rights Reserved.