当前位置: 首页>>代码示例>>Java>>正文


Java UntypedActor类代码示例

本文整理汇总了Java中akka.actor.UntypedActor的典型用法代码示例。如果您正苦于以下问题:Java UntypedActor类的具体用法?Java UntypedActor怎么用?Java UntypedActor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UntypedActor类属于akka.actor包,在下文中一共展示了UntypedActor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: install

import akka.actor.UntypedActor; //导入依赖的package包/类
/** implementation du service Install */   
@SuppressWarnings("serial")
public void install(String nomLogiciel, String listImages) {
	
	if (nomLogiciel.equals("frascati")) this.logiciel= this.logicielFrascati;
	if (nomLogiciel.equals("nodejs")) this.logiciel= this.logicielNodejs;
	
	this.imageVirtuels.clear();
	
	String tab[]= listImages.split(" ");
	for (int i = 0; i < tab.length; i++) {
		this.imageVirtuels.add(new VirtuelImage(tab[i],tab[i],tab[i]));
	}
	
	// creation de l'actor ControllerSoftwareSupervisor
	controllerSoftwareSupervisor = systemSoftware.actorOf(new Props(new UntypedActorFactory() {
		public UntypedActor create() {
		 return new ControllerSoftwareSupervisor(imageVirtuels,logiciel,sh,new Props(WorkerInstall.class),listener);
		}
	}), "ControllerVMSupervisor");		
	 
	// demarrer le déploiement
	controllerSoftwareSupervisor.tell(new MessageExecuteService());	
	
}
 
开发者ID:Spirals-Team,项目名称:peak-forecast,代码行数:26,代码来源:ControllerSoftwareImpl.java

示例2: createContainer

import akka.actor.UntypedActor; //导入依赖的package包/类
/** implementation du service Create container */   
@SuppressWarnings("serial")
public void createContainer(String listImages) {

		System.out.println("nom des container à créer "+listImages);
               	
this.imageVirtuels.clear();
			String tab[]= listImages.split(" ");
			for (int i = 0; i < tab.length; i++) {
				this.imageVirtuels.add(new VirtuelImage(tab[i],tab[i],tab[i]));	
			}
							
	// creation de l'actor ControllerVMSupervisor
	controllerVmSupervisor = systemVm.actorOf(new Props(new UntypedActorFactory() {
		public UntypedActor create() {
		 return new ControllerVMSupervisor(imageVirtuels,pathFabFile,sh,new Props(WorkerCreateContainer.class),listener);
		}
	}), "ControllerVMSupervisor");		
	 
	// démarrer l'exécution
	controllerVmSupervisor.tell(new MessageExecuteService());	
	
}
 
开发者ID:Spirals-Team,项目名称:peak-forecast,代码行数:24,代码来源:ControllerVMImpl.java

示例3: startContainer

import akka.actor.UntypedActor; //导入依赖的package包/类
/** implementation du service Create container */   
@SuppressWarnings("serial")
public void startContainer(String listImages) {
this.imageVirtuels.clear();
		String tab[]= listImages.split(" ");
		for (int i = 0; i < tab.length; i++) {
			this.imageVirtuels.add(new VirtuelImage(tab[i],tab[i],tab[i]));	
		}
				
	// creation de l'actor ControllerVMSupervisor
	controllerVmSupervisor = systemVm.actorOf(new Props(new UntypedActorFactory() {
		public UntypedActor create() {
		 return new ControllerVMSupervisor(imageVirtuels,pathFabFile,sh,new Props(WorkerStartContainer.class),listener);
		}
	}), "ControllerVMSupervisor");		
	 
	// démarrer l'exécution
	controllerVmSupervisor.tell(new MessageExecuteService());	
	
}
 
开发者ID:Spirals-Team,项目名称:peak-forecast,代码行数:21,代码来源:ControllerVMImpl.java

示例4: stopContainer

import akka.actor.UntypedActor; //导入依赖的package包/类
/** implementation du service Create container */   
	@SuppressWarnings("serial")
	public void stopContainer(String listImages) {
					
this.imageVirtuels.clear();
		String tab[]= listImages.split(" ");
		for (int i = 0; i < tab.length; i++) {
			this.imageVirtuels.add(new VirtuelImage(tab[i],tab[i],tab[i]));	
		}
		// creation de l'actor ControllerVMSupervisor
		controllerVmSupervisor = systemVm.actorOf(new Props(new UntypedActorFactory() {
			public UntypedActor create() {
			 return new ControllerVMSupervisor(imageVirtuels,pathFabFile,sh,new Props(WorkerStopContainer.class),listener);
			}
		}), "ControllerVMSupervisor");		
		 
		// démarrer l'exécution
		controllerVmSupervisor.tell(new MessageExecuteService());	
		
	}
 
开发者ID:Spirals-Team,项目名称:peak-forecast,代码行数:21,代码来源:ControllerVMImpl.java

示例5: subscribeEvent

import akka.actor.UntypedActor; //导入依赖的package包/类
/**
 * Attempts to register the subscriber to the specified channel.
 *
 * @return the temporary actor that delegates the event to given handler
 */
public <T> ActorRef subscribeEvent(final Handler<T> handler, final Class<T> channel) {
    ActorRef ref = system.actorOf(new Props().withCreator(new Creator<Actor>() {
        @Override
        public Actor create() throws Exception {
            return new UntypedActor() {
                @Override
                public void onReceive(Object message) throws Exception {
                    if (message != null && message.getClass().equals(channel)) {
                        handler.handle(channel.cast(message));
                    } else {
                        unhandled(message);
                    }
                }
            };
        }
    }));

    eventStream().subscribe(ref, channel);
    return ref;
}
 
开发者ID:l0rdn1kk0n,项目名称:wicket-akka,代码行数:26,代码来源:Akka.java

示例6: detach

import akka.actor.UntypedActor; //导入依赖的package包/类
@Test
public void detach() throws Exception {
    ActorModel<Integer> model = new ActorModel<Integer>() {
        @Override
        protected ActorRef newActor() {
            return system().actorOf(Props.apply(new Creator<Actor>() {
                @Override
                public Actor create() throws Exception {
                    return new UntypedActor() {
                        @Override
                        public void onReceive(Object message) throws Exception {
                            unhandled(message);
                        }
                    };
                }
            }));
        }
    };

    model.detach();
    Thread.sleep(100);

    assertThat(model.getObject(), is(nullValue()));
    assertThat(model.getActorRef().isTerminated(), is(true));
}
 
开发者ID:l0rdn1kk0n,项目名称:wicket-akka,代码行数:26,代码来源:ActorModelTest.java

示例7: RegisterActors

import akka.actor.UntypedActor; //导入依赖的package包/类
private static void RegisterActors(Binder binder) {
	Logger.debug("Actor Scanner Started...");
	final Map<String, ActorHolder> map = new HashMap<>();		
	final ConfigurationBuilder configBuilder = build();
	final Reflections reflections = new Reflections(configBuilder.setScanners(new SubTypesScanner()));
	final Set<Class<? extends UntypedActor>> actors = reflections.getSubTypesOf(UntypedActor.class);
       final Set<Class<? extends AbstractActor>> abstractActors = reflections.getSubTypesOf(AbstractActor.class);
       loopOnActors(map, actors);
       loopOnAbstractActors(map, abstractActors);
       if(!map.isEmpty()) Logger.debug("Registering actors: ");
	for(final String key : map.keySet()) {
		final ActorHolder actorHolder = map.get(key);
		final Class<? extends Actor> actor = actorHolder.getActor();
		if(actorHolder.isSingleton()) {
			Logger.debug("Binding class " + actor.getSimpleName() + " to name: " + key + " Singleton Scoped.");
			binder.bind(ActorRef.class).annotatedWith(Names.named(key)).toProvider(new ActorRefProvider(actor, key, true)).in(Singleton.class);
		} else {
			Logger.debug("Binding class " + actor.getSimpleName() + " to name: " + key + " Request Scoped.");
			binder.bind(ActorRef.class).annotatedWith(Names.named(key)).toProvider(new ActorRefProvider(actor, key, false));
			PropsContext.put(key, actorHolder);
		}
	}
}
 
开发者ID:chanan,项目名称:AkkaGuice,代码行数:24,代码来源:AkkaGuiceModule.java

示例8: loopOnActors

import akka.actor.UntypedActor; //导入依赖的package包/类
private static void loopOnActors(Map<String, ActorHolder> map, Set<Class<? extends UntypedActor>> actors) {
    for(final Class<? extends Actor> actor : actors) {
        if(ignore.contains(actor.getSimpleName())) continue;
        final String named = getNamed(actor);
        final boolean isSingleton = isSingleton(actor);
        final ActorHolder actorHolder = new ActorHolder(actor, isSingleton);
        if(named != null) {
            map.put(named, actorHolder);
        } else {
            if(map.containsKey(actor.getSimpleName())){
                map.put(actor.getName(), actorHolder);
                final ActorHolder tempHolder = map.remove(actor.getSimpleName());
                map.put(tempHolder.getActor().getName(), tempHolder);
            }
            else map.put(actor.getSimpleName(), actorHolder);
        }
    }
}
 
开发者ID:chanan,项目名称:AkkaGuice,代码行数:19,代码来源:AkkaGuiceModule.java

示例9: remoteActorRefDemo

import akka.actor.UntypedActor; //导入依赖的package包/类
@SuppressWarnings("serial")
public void remoteActorRefDemo() {
	log.info("Creating a reference to remote actor");
	// creating a reference to the remote ServerActor
	// by passing the complete remote actor path
	remoteActor = system
			.actorFor("akka://[email protected]:2552/user/serverActor");

	log.info("ServerActor with hashcode #" + remoteActor.hashCode());
	
	// create a local actor and pass the reference of the remote actor
	actor = system.actorOf(new Props(new UntypedActorFactory() {
		public UntypedActor create() {
			return new ClientActor(remoteActor);
		}
	}));
	// send a message to the local client actor
	actor.tell("Start-RemoteActorRef");
}
 
开发者ID:rokumar7,项目名称:trial,代码行数:20,代码来源:ClientActorSystem.java

示例10: remoteActorCreationDemo1

import akka.actor.UntypedActor; //导入依赖的package包/类
@SuppressWarnings("serial")
public void remoteActorCreationDemo1() {
	log.info("Creating a actor using remote deployment mechanism");

	// create the address object that points to the remote server
	Address addr = new Address("akka", "ServerSys", "127.0.0.1", 2552);

	// creating the ServerActor on the specified remote server
	final ActorRef serverActor = system.actorOf(new Props(ServerActor.class)
			.withDeploy(new Deploy(new RemoteScope(addr))));

	// create a local actor and pass the reference of the remote actor
	actor = system.actorOf(new Props(new UntypedActorFactory() {
		public UntypedActor create() {
			return new ClientActor(serverActor);
		}
	}));
	// send a message to the local client actor
	actor.tell("Start-RemoteActorCreationDemo1");
}
 
开发者ID:rokumar7,项目名称:trial,代码行数:21,代码来源:ClientActorSystem.java

示例11: remoteActorCreationDemo2

import akka.actor.UntypedActor; //导入依赖的package包/类
@SuppressWarnings("serial")
public void remoteActorCreationDemo2() {
	log.info("Creating a actor with remote deployment");

	// alternate way to create the address object that points to the remote
	// server
	Address addr = AddressFromURIString
			.parse("akka://[email protected]:2552");

	// creating the ServerActor on the specified remote server
	final ActorRef serverActor = system.actorOf(new Props(ServerActor.class)
			.withDeploy(new Deploy(new RemoteScope(addr))));

	// create a local actor and pass the reference of the remote actor
	actor = system.actorOf(new Props(new UntypedActorFactory() {
		public UntypedActor create() {
			return new ClientActor(serverActor);
		}
	}));
	// send a message to the local client actor
	actor.tell("Start-RemoteActorCreationDemo2");
}
 
开发者ID:rokumar7,项目名称:trial,代码行数:23,代码来源:ClientActorSystem.java

示例12: remoteActorCreationDemo3

import akka.actor.UntypedActor; //导入依赖的package包/类
@SuppressWarnings("serial")
public void remoteActorCreationDemo3() {
	log.info("Creating a actor with remote deployment");

	// creating the ServerActor on the specified remote server
	final ActorRef serverActor = system.actorOf(new Props(ServerActor.class),"remoteServerActor");

	// create a local actor and pass the reference of the remote actor
	actor = system.actorOf(new Props(new UntypedActorFactory() {
		public UntypedActor create() {
			return new ClientActor(serverActor);
		}
	}));
	// send a message to the local client actor
	actor.tell("Start-RemoteActorCreationDemo3");
}
 
开发者ID:rokumar7,项目名称:trial,代码行数:17,代码来源:ClientActorSystem.java

示例13: testFilteringActor

import akka.actor.UntypedActor; //导入依赖的package包/类
@Test
public void testFilteringActor() {
	ActorRef filteringActorRef = _system.actorOf(new Props(
			new UntypedActorFactory() {
				public UntypedActor create() {
					return new FilteringActor(testActor());
				}
			}));
	// pass the reference to implicit sender testActor() otherwise
	// message end up in dead mailbox
	// first test
	filteringActorRef.tell("test message", super.testActor());
	expectMsg("test message");
	// second test
	filteringActorRef.tell(1, super.testActor());
	expectNoMsg();
}
 
开发者ID:rokumar7,项目名称:trial,代码行数:18,代码来源:ExampleUnitTest.java

示例14: ApplicationManagerSystem

import akka.actor.UntypedActor; //导入依赖的package包/类
public ApplicationManagerSystem() {

		final int no_of_workers = 10;

		system = ActorSystem.create("LoadGeneratorApp");

		final ActorRef appManager = system.actorOf(
				new Props(new UntypedActorFactory() {
					public UntypedActor create() {
						return new JobControllerActor(no_of_msgs);
					}
				}), "jobController");

		router = system.actorOf(new Props(new UntypedActorFactory() {
			public UntypedActor create() {
				return new WorkerActor(appManager);
			}
		}).withRouter(new RoundRobinRouter(no_of_workers)));
	}
 
开发者ID:rokumar7,项目名称:trial,代码行数:20,代码来源:ApplicationManagerSystem.java

示例15: newFollowerContext

import akka.actor.UntypedActor; //导入依赖的package包/类
private static RaftActorContextImpl newFollowerContext(String id, TestActorRef<? extends UntypedActor> actor) {
    DefaultConfigParamsImpl configParams = new DefaultConfigParamsImpl();
    configParams.setHeartBeatInterval(new FiniteDuration(100, TimeUnit.MILLISECONDS));
    configParams.setElectionTimeoutFactor(100000);
    NonPersistentDataProvider noPersistence = new NonPersistentDataProvider(Runnable::run);
    ElectionTermImpl termInfo = new ElectionTermImpl(noPersistence, id, LOG);
    termInfo.update(1, LEADER_ID);
    return new RaftActorContextImpl(actor, actor.underlyingActor().getContext(),
            id, termInfo, -1, -1, ImmutableMap.of(LEADER_ID, ""), configParams,
            noPersistence, applyState -> actor.tell(applyState, actor), LOG);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:RaftActorServerConfigurationSupportTest.java


注:本文中的akka.actor.UntypedActor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。