public <T> T get(String identifier,
Class<T> cls) {
//@TODO: this was done just as a hack to have the information ready, requires review and refactoring
if(cls.isAssignableFrom(String.class)){
CommandImpl cmd = new CommandImpl( "lookupKsessionId",
Arrays.asList( new Object[]{identifier} ) );
ConversationManager connm = this.grid.get( ConversationManager.class );
Object result = ConversationUtil.sendMessage( connm,
(InetSocketAddress) ((Map<String, Address>)this.gsd.getAddresses()).get( "socket" ).getObject(),
this.gsd.getId(),
cmd );
return (T)result;
}
if(cls.isAssignableFrom(StatefulKnowledgeSession.class) ){
if ( logger.isDebugEnabled() ) {
logger.debug( "(" + Thread.currentThread().getId() + ")"+Thread.currentThread().getName() +"GNRC I'm now trying to locate a happy SKS..." + identifier );
}
CommandImpl cmd = new CommandImpl( "lookupKsession",
Arrays.asList( new Object[]{identifier} ) );
if ( logger.isDebugEnabled() ) {
logger.debug( "(" + Thread.currentThread().getId() + ")"+Thread.currentThread().getName() +"GNRC I have the command ready" );
}