本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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
}
示例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");
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}