private ServerPeer getServerPeer(Object obj) throws Exception
{
if (obj instanceof ConnectionAdvised)
{
ConnectionAdvised adv = (ConnectionAdvised) obj;
ServerConnectionEndpoint endpoint = (ServerConnectionEndpoint )adv.getEndpoint();
return endpoint.getServerPeer();
}
else if (obj instanceof SessionAdvised)
{
SessionAdvised adv = (SessionAdvised) obj;
ServerSessionEndpoint endpoint = (ServerSessionEndpoint)adv.getEndpoint();
return endpoint.getConnectionEndpoint().getServerPeer();
}
else if (obj instanceof ConnectionFactoryAdvised)
{
ConnectionFactoryAdvised adv = (ConnectionFactoryAdvised) obj;
ServerConnectionFactoryEndpoint endpoint = (ServerConnectionFactoryEndpoint)adv.getEndpoint();
return endpoint.getServerPeer();
}
else
{
throw new IllegalStateException("PoisonInterceptor doesn't support " +
obj.getClass().getName() +