public LocalGridNodeConnection( String id, Grid grid ) { gridNode = new GridNodeImpl( id, grid ); }
public <T> T get(Class<T> serviceClass) { return get( serviceClass.getName(), serviceClass ); }
@Test public void simpleEvictionTest() throws InterruptedException { MessageReceiverHandler handler = new GridNodeImpl( "myNode", null ).getMessageReceiverHandler(); ContextImplWithEviction contextTemp = (ContextImplWithEviction) ((GridNodeServer) handler).getData().getTemp(); ((ContextImplWithEviction) contextTemp).setEntryEvictionTime(2000); // 2 seconds ((ContextImplWithEviction) contextTemp).setEvictionWakeUpTime(1000); // 1 seconds JDKTimerService timer = new JDKTimerService(1); contextTemp.set("myvalue", "value"); Long evictionWakeUpTime = contextTemp.getEvictionWakeUpTime(); timer.scheduleJob(new EvictionJob(contextTemp), new MockJobContext(), new MockTrigger(new Date(), evictionWakeUpTime)); //Set the timestamp for the first time contextTemp.set("myvalue", "value"); Thread.sleep(1000); //Update the timestamp String value = (String) contextTemp.get("myvalue"); //Wait for eviction Thread.sleep(4000); assertNull((String) contextTemp.get("myvalue")); }
public GridNode createGridNode(String id) { // WhitePages wp = get( WhitePages.class ); // GridServiceDescription gsd = wp.create( id ); // gsd.setServiceInterface( GridNode.class ); GridNode node = new GridNodeImpl( id ); this.localNodes.put( id, node ); return node; }
public <T> T get(Class<T> serviceClass) { return get(serviceClass.getName(), serviceClass); }
public GridNode createGridNode(String id) { // WhitePages wp = get( WhitePages.class ); // GridServiceDescription gsd = wp.create( id ); // gsd.setServiceInterface( GridNode.class ); GridNode node = new GridNodeImpl( id ); this.localNodes.put( id, node ); return node; }
public <T> T get(Class<T> serviceClass) { return get( serviceClass.getName(), serviceClass ); }
public GridNode createGridNode(String id) { // WhitePages wp = get( WhitePages.class ); // GridServiceDescription gsd = wp.create( id ); // gsd.setServiceInterface( GridNode.class ); GridNode node = new GridNodeImpl( id ); this.localNodes.put( id, node ); return node; }
public <T> T get(Class<T> serviceClass) { return get( serviceClass.getName(), serviceClass ); }
public void configureService( Grid grid ) { GridNode gnode = (this.gnode != null) ? this.gnode : new GridNodeImpl( grid ); ((GridImpl) grid).addService( GridNode.class, gnode ); }
public GridNode createGridNode( String id ) { if ( logger.isDebugEnabled() ) { logger.debug( " ### GridImpl: Registering in white pages (grid = " + getId() + ") new node = " + id ); } WhitePages wp = get( WhitePages.class ); GridServiceDescription gsd = wp.create( id, this.id ); gsd.setServiceInterface( GridNode.class ); GridNode node = new GridNodeImpl( id, this ); this.localNodes.put( id , node ); return node; }
public GridNode claimGridNode( String id ) { if ( logger.isDebugEnabled() ) { logger.debug( " ### GridImpl: Claiming orphan node " + id + " found in white pages (grid = " + getId() + ") " ); } WhitePages wp = get( WhitePages.class ); wp.remove( id ); GridServiceDescription gsd = wp.create( id, this.id ); gsd.setServiceInterface( GridNode.class ); GridNode node = new GridNodeImpl( id, this ); this.localNodes.put( id , node ); return node; }
public static KnowledgeBase createKnowledgeBase(GridNode node,String resource,String resourcetype){ if ( node == null ) { node = new GridNodeImpl(); } //kbase configuration PackageBuilderConfiguration kconf = (PackageBuilderConfiguration) KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,DroolsBlueprintBean.class.getClassLoader()); //kbuilder KnowledgeBuilder kbuilder = node.get( KnowledgeBuilderFactoryService.class ).newKnowledgeBuilder( kconf); kbuilder.add(parseResource(resource),ResourceType.getResourceType(resourcetype)); // error handling KnowledgeBuilderErrors errors = kbuilder.getErrors(); if ( !errors.isEmpty() ) { throw new RuntimeException( errors.toString() ); } //KnowledgeBase KnowledgeBaseConfiguration kbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null, DroolsBlueprintBean.class.getClassLoader()); KnowledgeBase kbase = node.get( KnowledgeBaseFactoryService.class ).newKnowledgeBase(kbaseConfig); kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() ); return kbase; }
public void afterPropertiesSet() throws Exception { if ( this.node == null ) { this.node = new GridNodeImpl();
public void afterPropertiesSet() throws Exception { if ( this.node == null ) { this.node = new GridNodeImpl();
public void afterPropertiesSet() throws Exception { if ( this.node == null ) { this.node = new GridNodeImpl();
@Test public void testConnectWithGivenGridNode() { GridNode gnode = new GridNodeImpl( null ); GridConnection<GridNode> connection = new LocalGridNodeConnection( gnode ); assertSame( gnode, connection.connect() ); }