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


Java CommonUtils.runtimeException方法代码示例

本文整理汇总了Java中com.ebay.jetstream.util.CommonUtils.runtimeException方法的典型用法代码示例。如果您正苦于以下问题:Java CommonUtils.runtimeException方法的具体用法?Java CommonUtils.runtimeException怎么用?Java CommonUtils.runtimeException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ebay.jetstream.util.CommonUtils的用法示例。


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

示例1: getInstance

import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
@Hidden
public static JetstreamApplication getInstance() {
  if (s_application == null) {
    synchronized (s_applicationClass) {
      if (s_application == null) {
        try {
          s_applicationClass.newInstance();
        }
        catch (Exception e) {
          throw CommonUtils.runtimeException(e);
        }
      }
    }
  }
  return s_application;
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:17,代码来源:JetstreamApplication.java

示例2: startStandAlone

import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
public void startStandAlone() {
    try {

        WebAppContext context = new WebAppContext();
        String baseUrl = getBaseUrl();
        LOGGER.info("Config server baseUrl: " + baseUrl);
        context.setDescriptor(baseUrl + "/WEB-INF/web.xml");
        context.setResourceBase(baseUrl);
        context.setContextPath("/");
        context.setParentLoaderPriority(true);
        Server s_server = new Server(s_port);
        // Jetty8 can not set thread pool size.
        s_server.setHandler(context);

        LOGGER.info( "Config server started, listening on port " + s_port);
        s_server.start();
        running.set(true);

    } catch (Throwable t) {
        throw CommonUtils.runtimeException(t);
    }
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:23,代码来源:ConfigServer.java

示例3: startStandAlone

import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
public void startStandAlone() {
    try {
        WebAppContext context = new WebAppContext();
        String baseUrl = getBaseUrl();
        LOGGER.info("Metric server baseUrl: " + baseUrl);
        context.setDescriptor(baseUrl + "/WEB-INF/web.xml");
        context.setResourceBase(baseUrl);
        context.setContextPath("/");
        context.setParentLoaderPriority(true);
        context.setAttribute("JetStreamRoot", applicationContext);
        Server s_server = new Server(s_port);
        s_server.setHandler(context);

        LOGGER.info( "Metric server started, listening on port " + s_port);
        s_server.start();
        running.set(true);
    } catch (Throwable t) {
        throw CommonUtils.runtimeException(t);
    }
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:21,代码来源:MetricServer.java

示例4: run

import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
@Override
public void run() {
  try {
    getInstance().shutdown();
  }
  catch (Throwable t) {
    throw CommonUtils.runtimeException(t);
  }
  System.out.println("Gracefully shutdown"); //KEEPME
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:11,代码来源:JetstreamApplication.java

示例5: subscribe

import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
void subscribe() {
    MessageService ms = MessageService.getInstance();

    if (ms.isInitialized()) {
        try {
            ms.subscribe(new JetstreamTopic(m_replayNotificationTopic), this);

            m_watchDog = Executors.newScheduledThreadPool(1);
            m_watchDog.scheduleWithFixedDelay(new Runnable() {

                @Override
                public void run() {
                    try {
                        checkStateMap();
                    } catch (Exception ex) {
                        LOGGER.error( "Fail to run watch dog task.", ex);
                    }
                }
                
            }, 1, 1, TimeUnit.MINUTES);
            if (LOGGER.isInfoEnabled()) {
                LOGGER.info( "Subscribed for Mongo Config Change Information using Message Service");
            }

        } catch (Exception e) {
            throw CommonUtils.runtimeException(e);
        }
    } else {
        LOGGER.error( "Message Service not initialized - unable to register listener");
    }
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:32,代码来源:RemoteController.java

示例6: stopApplication

import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
@ManagedOperation
public void stopApplication() {
    try {
        getInstance().shutdown();
    } catch (Throwable t) {
        throw CommonUtils.runtimeException(t);
    }
    System.out.println("Gracefully stop the application");
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    System.exit(0);
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:16,代码来源:ConfigurationManagementApp.java

示例7: sendError

import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
private void sendError(HttpServletResponse response, int statusCode, String message) {
  try {
    response.sendError(statusCode, message);
  }
  catch (Throwable t) {
    throw CommonUtils.runtimeException(t);
  }
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:9,代码来源:ManagementServlet.java

示例8: getContexts

import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
/**
 * Returns all context files at the given path, across multiple data stores: files, svn/dav, etc.
 * 
 * @param path
 *            the directory path to look for context files.
 * @return all files ending in .xml at the given path.
 */
public static List<String> getContexts(String path) {
  try {
    ConfigDataSource cds = ConfigUtils.getConfigDataSource(path);
    List<String> names = new ArrayList<String>(cds.getStreamLocations());
    for (int i = names.size() - 1; i >= 0; i--)
      if (!names.get(i).toUpperCase().endsWith(".XML"))
        names.remove(i);
    return names;
  }
  catch (Throwable t) {
    throw CommonUtils.runtimeException(t);
  }
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:21,代码来源:Configuration.java

示例9: getResourceByPath

import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
@Override
protected Resource getResourceByPath(String path) {
  if (m_configResources != null)
    for (Resource r : m_configResources)
      try {
        URL url = r.getURL();
        if (url != null && path.equals(url.toExternalForm()))
          return r;
      }
      catch (IOException e) { // NOPMD
        // Ignore
      }

  try {
    if (path.startsWith("http:") || path.startsWith("https:"))
      return new UrlResource(path);

    if (path.startsWith("mongo:") || path.startsWith("mongos:"))
        return new MongoDbResource(this, path);

    if (path.startsWith("classpath:"))
      return new ClassPathResource(path, Configuration.class);

    return new FileSystemResource(path);
  }
  catch (Throwable t) {
    LOGGER.error( "Failed to load " + path + ": " + t);
    throw CommonUtils.runtimeException(t);
  }
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:31,代码来源:Configuration.java


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