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


Java Task.done方法代码示例

本文整理汇总了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();
}
 
开发者ID:orbit,项目名称:orbit-samples,代码行数:18,代码来源:ChatActor.java

示例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();
}
 
开发者ID:orbit,项目名称:orbit-spring,代码行数:15,代码来源:ActorInfoContributorLifetimeExtension.java

示例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();
}
 
开发者ID:orbit,项目名称:orbit-dynamodb,代码行数:10,代码来源:DynamoDBStorageExtension.java

示例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();
}
 
开发者ID:orbit,项目名称:orbit-hk2,代码行数:15,代码来源:HK2LifetimeExtension.java

示例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();
}
 
开发者ID:orbit,项目名称:orbit-hk2,代码行数:40,代码来源:Container.java

示例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);
}
 
开发者ID:orbit,项目名称:orbit-samples,代码行数:40,代码来源:ChatWebSocket.java

示例7: postActivation

import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<?> postActivation(final AbstractActor<?> actor)
{
    executor.execute(new AsyncJob(actor, true));
    return Task.done();
}
 
开发者ID:orbit,项目名称:orbit-spring,代码行数:7,代码来源:AsyncLifetimeExtension.java

示例8: postDeactivation

import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<?> postDeactivation(final AbstractActor<?> actor)
{
    executor.execute(new AsyncJob(actor, false));
    return Task.done();
}
 
开发者ID:orbit,项目名称:orbit-spring,代码行数:7,代码来源:AsyncLifetimeExtension.java

示例9: setStat

import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<Void> setStat(final int stat)
{
    this.stat = stat;
    return Task.done();
}
 
开发者ID:orbit,项目名称:orbit-spring,代码行数:7,代码来源:ActorInfoContributorIntegrationTest.java

示例10: touch

import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<Void> touch()
{
    return Task.done();
}
 
开发者ID:orbit,项目名称:orbit-spring,代码行数:6,代码来源:ActorInfoContributorIntegrationTest.java

示例11: stop

import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
@Override
public Task<Void> stop()
{
    return Task.done();
}
 
开发者ID:orbit,项目名称:orbit-dynamodb,代码行数:6,代码来源:DynamoDBStorageExtension.java

示例12: clear

import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
public Task<Void> clear()
{
    clearState().join();
    return Task.done();
}
 
开发者ID:orbit,项目名称:orbit-dynamodb,代码行数:6,代码来源:HelloBaseActor.java

示例13: setSampleData

import cloud.orbit.concurrent.Task; //导入方法依赖的package包/类
public Task<Void> setSampleData(final HelloDto sampleData)
{
    state().sampleData = sampleData;
    writeState().join();
    return Task.done();
}
 
开发者ID:orbit,项目名称:orbit-dynamodb,代码行数:7,代码来源:HelloBaseActor.java

示例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();
}
 
开发者ID:orbit,项目名称:orbit-hk2,代码行数:11,代码来源:Container.java


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