本文整理汇总了Java中cloud.orbit.concurrent.Task.done方法的典型用法代码示例。如果您正苦于以下问题:Java Task.done方法的具体用法?Java Task.done怎么用?Java Task.done使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloud.orbit.concurrent.Task
的用法示例。
在下文中一共展示了Task.done方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: say
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<Void> say(final ChatMessageDto message)
{
if (getLogger().isDebugEnabled())
{
getLogger().debug("Message received: " + message.getMessage());
}
message.setWhen(new Date());
state().history.add(message);
trimHistory();
state().observers.notifyObservers(o -> o.receiveMessage(message));
if (System.currentTimeMillis() - lastSave > TimeUnit.SECONDS.toMillis(60))
{
return writeState();
}
return Task.done();
}
示例2: doIfInfoContributor
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
private Task<?> doIfInfoContributor(final AbstractActor<?> actor,
final Consumer<ActorInfoContributorReference> synchronizedAction)
{
if (actor instanceof InfoContributor)
{
ActorInfoContributorReference actorInfoContributorReference =
new ActorInfoContributorReference(actorTypeResolver, actor);
synchronized (actorInfoContributorReferences)
{
synchronizedAction.accept(actorInfoContributorReference);
}
}
return Task.done();
}
示例3: start
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<Void> start()
{
dynamoDBConnection = new DynamoDBConnection(dynamoDBConfiguration);
DynamoDBUtils.getTable(dynamoDBConnection, defaultTableName).join();
return Task.done();
}
示例4: preActivation
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task preActivation(AbstractActor actor)
{
if(container != null)
{
container.inject(actor);
}
else if(serviceLocator != null)
{
serviceLocator.inject(actor);
}
return Task.done();
}
示例5: start
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
public Task start()
{
logger.info("Starting orbit container...");
try
{
// Read configuration
if(config == null)
{
config = YAMLConfigReader.readConfig();
}
// Override the name if needed
containerName = config.getAsString("orbit.container.name", containerName);
// Create the DI container
ServiceLocatorFactory factory = ServiceLocatorFactory.getInstance();
serviceLocator = factory.create(containerName);
ServiceLocatorUtilities.addOneConstant(getServiceLocator(), this);
// Discover addons
discoverAddons();
// Crawl the packages and make the container aware of them
crawlPackages();
}
catch(Exception e)
{
logger.error(e.toString());
}
// Initialize singletons/services
initServices();
logger.info("Container successfully started.");
return Task.done();
}
示例6: onWebSocketConnect
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@OnOpen
public void onWebSocketConnect(Session session)
{
chat = Actor.getReference(Chat.class, session.getPathParameters().get("chatName"));
observer = new ChatObserver()
{
@Override
public Task<Void> receiveMessage(final ChatMessageDto message)
{
JsonObject jsonObject = Json.createObjectBuilder()
.add("message", message.getMessage())
.add("sender", message.getSender())
.add("received", ZonedDateTime.ofInstant(message.getWhen().toInstant(), ZoneId.systemDefault()).format(DateTimeFormatter.ISO_INSTANT))
.build();
session.getAsyncRemote().sendObject(jsonObject.toString());
return Task.done();
}
};
chat.join(observer);
chat.getHistory(100).thenAccept(ms -> {
JsonArrayBuilder array = Json.createArrayBuilder();
ms.stream().forEach(
m -> array.add(
Json.createObjectBuilder()
.add("message", m.getMessage())
.add("sender", m.getSender())
.add("received", m.getWhen().toInstant().atZone(ZoneId.systemDefault()).format(DateTimeFormatter.ISO_INSTANT))
.build()
)
);
session.getAsyncRemote().sendObject(
Json.createObjectBuilder().add("history", array).build().toString());
}
);
logger.info("Socket Connected: " + session);
}
示例7: postActivation
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<?> postActivation(final AbstractActor<?> actor)
{
executor.execute(new AsyncJob(actor, true));
return Task.done();
}
示例8: postDeactivation
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<?> postDeactivation(final AbstractActor<?> actor)
{
executor.execute(new AsyncJob(actor, false));
return Task.done();
}
示例9: setStat
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<Void> setStat(final int stat)
{
this.stat = stat;
return Task.done();
}
示例10: touch
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<Void> touch()
{
return Task.done();
}
示例11: stop
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<Void> stop()
{
return Task.done();
}
示例12: clear
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
public Task<Void> clear()
{
clearState().join();
return Task.done();
}
示例13: setSampleData
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
public Task<Void> setSampleData(final HelloDto sampleData)
{
state().sampleData = sampleData;
writeState().join();
return Task.done();
}
示例14: stop
import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
public Task stop()
{
logger.info("Stopping orbit container...");
destroyServices();
logger.info("Container successfully stopped.");
return Task.done();
}