本文整理了Java中org.jgroups.util.Util.getMessage()
方法的一些代码示例,展示了Util.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getMessage()
方法的具体详情如下:
包路径:org.jgroups.util.Util
类名称:Util
方法名:getMessage
暂无
代码示例来源:origin: wildfly/wildfly
public void warning(SAXParseException exception) throws SAXException {
log.warn(Util.getMessage("ParseFailure"), exception);
}
代码示例来源:origin: wildfly/wildfly
public ConnBuilder method(String method) {
try {
con.setRequestMethod(method);
} catch (ProtocolException e) {
log.error(Util.getMessage("ProtocolError"), e);
}
return this;
}
代码示例来源:origin: wildfly/wildfly
protected boolean deleteFile(File file) {
boolean result = true;
if(file != null && file.exists()) {
try {
result=file.delete();
log.trace("deleted file %s: result=%b ", file.getAbsolutePath(), result);
}
catch(Throwable e) {
log.error(Util.getMessage("FailedToDeleteFile") + file.getAbsolutePath(), e);
}
}
return result;
}
代码示例来源:origin: wildfly/wildfly
/**
* Attempts to delete the provided file.<br>
* Logging is performed on the result
* @param file
* @return
*/
protected boolean deleteFile(File file) {
boolean result = true;
if(file != null && file.exists()) {
try {
result=file.delete();
if(log.isTraceEnabled())
log.trace("Deleted file result: "+file.getAbsolutePath() +" : "+result);
}
catch(Throwable e) {
log.error(Util.getMessage("FailedToDeleteFile") + file.getAbsolutePath(), e);
}
}
return result;
}
代码示例来源:origin: wildfly/wildfly
protected void handleTaskRejectedResponse(Address source, long requestId) {
Runnable runnable = _awaitingReturn.remove(new Owner(
source, requestId));
if (runnable != null) {
_awaitingConsumer.add(runnable);
Long taskRequestId = _requestId.get(runnable);
if (taskRequestId != requestId) {
log.warn("Task Request Id doesn't match in rejection");
}
sendToCoordinator(RUN_REQUEST, taskRequestId, local_addr);
}
else {
log.error(Util.getMessage("ErrorResubmittingTaskForRequestId") + requestId);
}
}
代码示例来源:origin: wildfly/wildfly
/**
*
* @param interfaces List<NetworkInterface>. Guaranteed to have no duplicates
* @param s
* @param mcastAddr
* @throws IOException
*/
protected void bindToInterfaces(List<NetworkInterface> interfaces,
MulticastSocket s,
InetAddress mcastAddr) {
SocketAddress tmp_mcast_addr=new InetSocketAddress(mcastAddr, mcast_port);
for(NetworkInterface intf: interfaces) {
//[ JGRP-680] - receive_on_all_interfaces requires every NIC to be configured
try {
s.joinGroup(tmp_mcast_addr, intf);
log.trace("joined %s on %s", tmp_mcast_addr, intf.getName());
}
catch(IOException e) {
log.warn(Util.getMessage("InterfaceJoinFailed"), tmp_mcast_addr, intf.getName());
}
}
}
代码示例来源:origin: wildfly/wildfly
protected void clearTable(String clustername) {
try(Connection conn=getConnection()) {
try (PreparedStatement ps=conn.prepareStatement(clear_sql)) {
// check presence of cluster_name parameter for backwards compatibility
if (clear_sql.indexOf('?') >= 0) {
ps.setString(1, clustername);
} else {
log.debug("Please update your clear_sql to include cluster_name parameter.");
}
if(log.isTraceEnabled())
log.trace("%s: SQL for clearing the table: %s", local_addr, ps);
ps.execute();
}
}
catch(SQLException e) {
log.error(Util.getMessage("ErrorClearingTable"), e);
}
}
代码示例来源:origin: wildfly/wildfly
/** Check if I'm in memberList, too */
/*public void start() throws Exception {
super.start();
IpAddress self=(IpAddress)auth.getPhysicalAddress();
if(!isInMembersList(self))
throw new IllegalStateException("own physical address " + self + " is not in members (" + memberList + ")");
} */
public boolean authenticate(AuthToken token, Message msg) {
if ((token != null) && (token instanceof FixedMembershipToken) && (this.memberList != null)) {
PhysicalAddress src = (PhysicalAddress) auth.down(new Event(Event.GET_PHYSICAL_ADDRESS, msg.getSrc()));
if (src == null) {
log.error(Util.getMessage("DidnTFindPhysicalAddressFor") + msg.getSrc());
return false;
}
return isInMembersList((IpAddress)src);
}
if (log.isWarnEnabled())
log.warn("Invalid AuthToken instance - wrong type or null");
return false;
}
代码示例来源:origin: wildfly/wildfly
protected void deliver(Message msg, Address sender, long seqno, String error_msg) {
if(is_trace)
log.trace("%s: delivering %s#%d", local_addr, sender, seqno);
try {
up_prot.up(msg);
}
catch(Throwable t) {
log.error(Util.getMessage("FailedToDeliverMsg"), local_addr, error_msg, msg, t);
}
}
代码示例来源:origin: wildfly/wildfly
protected void deliverMessage(final Message msg, final Address sender, final long seqno) {
if(is_trace)
log.trace("%s: delivering %s#%s", local_addr, sender, seqno);
try {
up_prot.up(msg);
}
catch(Throwable t) {
log.warn(Util.getMessage("FailedToDeliverMsg"), local_addr, msg.isFlagSet(Message.Flag.OOB) ?
"OOB message" : "message", msg, t);
}
}
代码示例来源:origin: wildfly/wildfly
protected void closeConnection(final Connection connection) {
try {
connection.close();
} catch (SQLException e) {
log.error(Util.getMessage("ErrorClosingConnectionToJDBCPINGDatabase"), e);
}
}
代码示例来源:origin: wildfly/wildfly
protected Attribute getNamedAttribute(String name) {
AttributeEntry entry=atts.get(name);
if(entry != null) {
try {
return new Attribute(name, entry.getter.invoke(null));
}
catch(Exception e) {
log.warn(Util.getMessage("AttrReadFailure"), name, e);
}
}
else {
log.warn(Util.getMessage("MissingAttribute"), name);
}
return null;
}
代码示例来源:origin: wildfly/wildfly
@Override
public void findMembers(List<Address> members, boolean initial_discovery, Responses responses) {
if(this.cluster_name == null) {
log.error(Util.getMessage("ClusternameIsNullCannotGetMembership"));
return;
}
log.trace("fetching members from GossipRouter(s)");
stubManager.forEach( stub -> {
try {
stub.getMembers(TCPGOSSIP.this.cluster_name, TCPGOSSIP.this);
}
catch(Throwable t) {
log.warn("failed fetching members from %s: %s, cause: %s", stub.gossipRouterAddress(), t, t.getCause());
}
});
}
代码示例来源:origin: wildfly/wildfly
@Override
protected void readAll(List<Address> members, String clustername, Responses responses) {
try {
List<String> objects = rackspaceClient.listObjects(container);
for(String object: objects) {
List<PingData> list=null;
byte[] bytes = rackspaceClient.readObject(container, object);
if((list=read(new ByteArrayInputStream(bytes))) == null) {
log.warn("failed reading " + object);
continue;
}
for(PingData data: list) {
if(members == null || members.contains(data.getAddress()))
responses.addResponse(data, data.isCoord());
if(local_addr != null && !local_addr.equals(data.getAddress()))
addDiscoveryResponseToCaches(data.getAddress(), data.getLogicalName(), data.getPhysicalAddr());
}
}
} catch (Exception e) {
log.error(Util.getMessage("ErrorUnmarshallingObject"), e);
}
}
代码示例来源:origin: wildfly/wildfly
public void handleMergeCancelled(MergeId merge_id) {
try {
gms.stopFlush();
}
catch(Throwable t) {
log.error(Util.getMessage("StopFlushFailed"), t.getMessage());
}
log.trace("%s: merge %s is cancelled", gms.local_addr, merge_id);
cancelMerge(merge_id);
}
代码示例来源:origin: wildfly/wildfly
protected void deliverBatch(MessageBatch batch) {
try {
if(batch.isEmpty())
return;
if(is_trace) {
Message first=batch.first(), last=batch.last();
StringBuilder sb=new StringBuilder(local_addr + ": delivering");
if(first != null && last != null) {
UnicastHeader3 hdr1=first.getHeader(id), hdr2=last.getHeader(id);
sb.append(" #").append(hdr1.seqno).append(" - #").append(hdr2.seqno);
}
sb.append(" (" + batch.size()).append(" messages)");
log.trace(sb);
}
up_prot.up(batch);
}
catch(Throwable t) {
log.warn(Util.getMessage("FailedToDeliverMsg"), local_addr, "batch", batch, t);
}
}
代码示例来源:origin: wildfly/wildfly
public ConnBuilder method(String method) {
try {
con.setRequestMethod(method);
} catch (ProtocolException e) {
log.error(Util.getMessage("ProtocolError"), e);
}
return this;
}
代码示例来源:origin: wildfly/wildfly
protected boolean setNamedAttribute(Attribute attribute) {
AttributeEntry entry=atts.get(attribute.getName());
if(entry != null) {
try {
entry.setter.invoke(attribute.getValue());
return true;
}
catch(Throwable e) {
log.warn(Util.getMessage("AttrWriteFailure"), attribute.getName(), e);
}
}
else {
log.warn(Util.getMessage("MissingAttribute"), attribute.getName());
}
return false;
}
代码示例来源:origin: wildfly/wildfly
protected synchronized void writeNodeToDisk(Address logical_addr, PhysicalAddress physical_addr) {
String filename=addressAsString(logical_addr);
// first write all data to a temporary file
// this is because the writing can be very slow under some circumstances
File tmpFile=null, destination=null;
try {
tmpFile=writeToTempFile(root_dir, logical_addr, physical_addr, NameCache.get(logical_addr));
if(tmpFile == null)
return;
destination=new File(root_dir, filename + SUFFIX);
//do a file move, this is much faster and could be considered atomic on most operating systems
FileChannel src_ch=new FileInputStream(tmpFile).getChannel();
FileChannel dest_ch=new FileOutputStream(destination).getChannel();
src_ch.transferTo(0,src_ch.size(),dest_ch);
src_ch.close();
dest_ch.close();
if(log.isTraceEnabled())
log.trace("Moved: " + tmpFile.getName() + "->" + destination.getName());
}
catch(Exception ioe) {
log.error(Util.getMessage("AttemptToMoveFailedAt") + tmpFile.getName() + "->" + destination.getName(), ioe);
}
finally {
deleteFile(tmpFile);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
protected void readAll(List<Address> members, String clustername, Responses responses) {
try {
List<String> objects = swiftClient.listObjects(container);
for(String object: objects) {
List<PingData> list=null;
byte[] bytes = swiftClient.readObject(container, object);
if((list=read(new ByteArrayInputStream(bytes))) == null) {
log.warn("failed reading " + object);
continue;
}
for(PingData data: list) {
if(members == null || members.contains(data.getAddress()))
responses.addResponse(data, data.isCoord());
if(local_addr != null && !local_addr.equals(data.getAddress()))
addDiscoveryResponseToCaches(data.getAddress(), data.getLogicalName(), data.getPhysicalAddr());
}
}
} catch (Exception e) {
log.error(Util.getMessage("ErrorUnmarshallingObject"), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!