本文整理了Java中com.vmware.xenon.common.Utils.toString()
方法的一些代码示例,展示了Utils.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.toString()
方法的具体详情如下:
包路径:com.vmware.xenon.common.Utils
类名称:Utils
方法名:toString
暂无
代码示例来源:origin: vmware/admiral
private static String getFactoryLinkFieldValue(Class<? extends StatefulService> type) {
try {
Field f = type.getField(UriUtils.FIELD_NAME_FACTORY_LINK);
return (String) f.get(null);
} catch (Exception e) {
logger.severe(String.format("%s field not found in class %s: %s",
UriUtils.FIELD_NAME_FACTORY_LINK,
type.getSimpleName(), Utils.toString(e)));
}
return null;
}
代码示例来源:origin: vmware/xenon
@Override
protected void handshakeFailure(ChannelHandlerContext ctx, Throwable cause)
throws Exception {
log(Level.WARNING, "TLS handshake failed: %s", Utils.toString(cause));
ctx.close();
}
代码示例来源:origin: vmware/xenon
public static Object getPropertyValue(PropertyDescription pd, Object instance) {
try {
return pd.accessor.get(instance);
} catch (Exception e) {
Utils.logWarning("Reflection error: %s", Utils.toString(e));
}
return null;
}
代码示例来源:origin: vmware/xenon
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
throws Exception {
log(Level.WARNING, "ALPN protocol negotiation failed: %s", Utils.toString(cause));
ctx.close();
}
代码示例来源:origin: vmware/xenon
private void executeRunnableSafe(Runnable task) {
try {
task.run();
} catch (Exception e) {
log(Level.SEVERE, "Unhandled exception executing task: %s", Utils.toString(e));
}
}
代码示例来源:origin: vmware/xenon
@Override
protected void handshakeFailure(ChannelHandlerContext ctx, Throwable cause)
throws Exception {
log(Level.WARNING, "TLS handshake failed: %s", Utils.toString(cause));
ctx.close();
}
代码示例来源:origin: vmware/xenon
public static <T> T instantiate(Class<T> clazz) {
try {
Constructor<T> ctor = clazz.getDeclaredConstructor();
if (!ctor.isAccessible()) {
ctor.setAccessible(true);
}
return ctor.newInstance();
} catch (Exception e) {
Utils.logWarning("Reflection error: %s", Utils.toString(e));
}
return null;
}
代码示例来源:origin: vmware/xenon
public static URI buildPublicUri(ServiceHost host, String path, String query) {
URI baseUri = host.getPublicUri();
try {
return new URI(baseUri.getScheme(), baseUri.getUserInfo(), baseUri.getHost(),
baseUri.getPort(), path, query, null);
} catch (Exception e) {
Utils.log(Utils.class, Utils.class.getSimpleName(), Level.SEVERE,
"Failure building uri %s, %s, %s: %s", baseUri, path, query,
Utils.toString(e));
}
return null;
}
代码示例来源:origin: vmware/admiral
private String buildSelfLink(Closure closureRequest) {
try {
return UriUtils.buildUriPath(ClosureFactoryService.FACTORY_LINK,
UriUtils.getLastPathSegment(new URI(closureRequest.documentSelfLink)));
} catch (URISyntaxException e) {
logError("Exception while building self link: %s", Utils.toString(e));
throw new RuntimeException("Wrong URI provided");
}
}
代码示例来源:origin: com.vmware.xenon/slf4j-xenon
private void doLog(Level lvl, FormattingTuple tuple) {
if (tuple.getThrowable() == null) {
Utils.log(this.logger, 5, this.name, lvl, "%s", tuple.getMessage());
} else {
Utils.log(this.logger, 5, this.name, lvl, "%s: %s", tuple.getMessage(), Utils.toString(tuple.getThrowable()));
}
}
代码示例来源:origin: vmware/xenon
@Override
public void failed(Throwable ex, Operation op) {
logWarning("Backup Failed %s", Utils.toString(ex));
try {
channel.close();
} catch (IOException e) {
}
// fail the put op, sender can retry sending the same range
put.fail(ex);
}
});
代码示例来源:origin: vmware/admiral
private DeferredResult<Void> freeProjectIndex(int index) {
if (index < 0) {
return DeferredResult.completed(null);
}
return UniquePropertiesUtil.freeProperty(this,
UniquePropertiesService.PROJECT_INDEXES_ID, Integer.toString(index))
.exceptionally(ex -> {
logWarning("Unable to free project index %d: %s",
index, Utils.toString(ex));
return null;
});
}
代码示例来源:origin: vmware/admiral
private DeferredResult<ComputeState> requestComputeState(String selfLink) {
URI uri = UriUtils.buildUri(host, selfLink);
Operation op = Operation.createGet(uri)
.setCompletion((o, e) -> {
if (e != null) {
logger.warning(String.format("Failed to retrieve compute state: [%s]", Utils.toString(e)));
return;
}
});
prepareRequest(op, false);
return host.sendWithDeferredResult(op, ComputeState.class);
}
代码示例来源:origin: vmware/admiral
private DeferredResult<Void> freeProjectName(String name) {
return UniquePropertiesUtil.freeProperty(this,
UniquePropertiesService.PROJECT_NAMES_ID, name)
.exceptionally(ex -> {
logWarning("Unable to free name %s: %s", name, Utils.toString(ex));
return null;
});
}
代码示例来源:origin: vmware/xenon
private void sendResponse(ChannelHandlerContext ctx, Operation request,
Integer streamId, String originalPath, double startTime) {
try {
applyRateLimit(ctx, request);
writeResponseUnsafe(ctx, request, streamId, originalPath, startTime);
} catch (Exception e1) {
this.host.log(Level.SEVERE, "%s", Utils.toString(e1));
}
}
代码示例来源:origin: vmware/xenon
private static void handleQueryCompletion(ServiceHost host, Operation o, Throwable e) {
if (e != null) {
host.log(Level.SEVERE, "Query task failed: %s", Utils.toString(e));
return;
}
QueryTask queryTask = o.getBody(QueryTask.class);
if (queryTask.results.documentLinks.isEmpty()) {
host.log(Level.INFO, "Query returned no results");
return;
}
host.log(Level.INFO, "Returned query results: %s", Utils.toJsonHtml(queryTask.results));
}
代码示例来源:origin: vmware/xenon
private void performIOMaintenance(Operation post, long now, MaintenanceStage nextStage,
long deadline) {
try {
this.operationTracker.performMaintenance(now);
performMaintenanceStage(post, nextStage, deadline);
} catch (Exception e) {
log(Level.WARNING, "Exception: %s", Utils.toString(e));
performMaintenanceStage(post, nextStage, deadline);
}
}
代码示例来源:origin: vmware/admiral
private void verifyDocumentExists(String documentLink) throws Throwable {
ServiceDocument document = getDocumentNoWait(ServiceDocument.class, documentLink);
try {
assertNotNull(String.format("Expected document [%s] to exist.", documentLink),
document);
} catch (AssertionError e) {
host.log(Level.SEVERE, Utils.toString(e));
throw e;
}
}
代码示例来源:origin: vmware/admiral
private void sendSelfPatch(DockerImage body) {
sendRequest(Operation
.createPatch(getUri())
.setBody(body)
.setCompletion((o, ex) -> {
if (ex != null) {
logWarning("Self patch failed: %s", Utils.toString(ex));
}
}));
}
代码示例来源:origin: vmware/admiral
protected void sendSelfPatch(Closure body) {
sendRequest(Operation
.createPatch(getUri())
.setBody(body)
.setCompletion((o, ex) -> {
if (ex != null) {
logWarning("Self patch failed: %s", Utils.toString(ex));
}
}));
}
内容来源于网络,如有侵权,请联系作者删除!