Package org.vertx.java.core.logging

Examples of org.vertx.java.core.logging.Logger


*/
public class UserAgentReaper extends Verticle {

    @Override
    public void start() {
        final Logger logger = container.logger();
        final Long reaperTimeout = container.config().getLong("userAgentReaperTimeout", 300000);
        logger.info("Started UserAgent Reaper with timeout of [" + reaperTimeout + "]");
        final ConcurrentMap<String, Long> lastAccessedMap = vertx.sharedData().getMap(VertxSimplePushServer.LAST_ACCESSED_MAP);
        final ConcurrentMap<String, String> writeHandlerMap = vertx.sharedData().getMap(VertxSimplePushServer.WRITE_HANDLER_MAP);

        vertx.setPeriodic(reaperTimeout, new Handler<Long>() {
            @Override
            public void handle(final Long timerId) {
                logger.info("UserAgentReaper reaping....");
                final Set<String> markedForRemoval = new HashSet<String>();
                final Set<Entry<String, Long>> entrySet = lastAccessedMap.entrySet();
                for (Entry<String, Long> entry : entrySet) {
                    final String uaid = entry.getKey();
                    final Long timestamp = entry.getValue();
View Full Code Here


        final SockJSServer sockJSServer = vertx.createSockJSServer(httpServer);
        sockJSServer.installApp(appConfig, new SimplePushServerHandler(simplePushServer, vertx, container));
    }

    private void setupUserAgentReaperJob(final SimplePushServer simplePushServer) {
        final Logger logger = container.logger();
        vertx.eventBus().registerHandler(USER_AGENT_REMOVER, new Handler<Message<String>>() {
            @Override
            public void handle(final Message<String> msg) {
                final String uaid = msg.body();
                simplePushServer.removeAllChannels(uaid);
                logger.info("Removed all channels for [" + uaid + "] due to inactivity");
            }
        });
        container.deployWorkerVerticle(UserAgentReaper.class.getName(), container.config());
    }
View Full Code Here

  // Must be synchronized since called directly from different thread
  private void addVerticle(Deployment deployment, Verticle verticle,
                           VerticleFactory factory, ModuleIdentifier modID, String main) {
    String loggerName = modID + "-" + main + "-" + System.identityHashCode(verticle);
    Logger logger = LoggerFactory.getLogger(loggerName);
    DefaultContext context = vertx.getContext();
    VerticleHolder holder = new VerticleHolder(deployment, context, verticle,
                                               loggerName, logger, deployment.config,
                                               factory);
    deployment.verticles.add(holder);
View Full Code Here

  public static Logger getLogger(final Class<?> clazz) {
    return getLogger(clazz.getCanonicalName());
  }

  public static Logger getLogger(final String name) {
    Logger logger = loggers.get(name);

    if (logger == null) {
      LogDelegate delegate = delegateFactory.createDelegate(name);

      logger = new Logger(delegate);

      Logger oldLogger = loggers.putIfAbsent(name, logger);

      if (oldLogger != null) {
        logger = oldLogger;
      }
    }
View Full Code Here

*/
public class PingVerticle extends Verticle {

  public void start() {

    final Logger logger = container.logger();

    vertx.eventBus().registerHandler("ping-address", new Handler<Message<String>>() {
      @Override
      public void handle(Message<String> message) {
        message.reply("pong!");
        logger.info("Sent back pong");
      }
    });


    logger.info("PingVerticle started");

  }
View Full Code Here

TOP

Related Classes of org.vertx.java.core.logging.Logger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.