本文整理匯總了Java中org.mortbay.log.Log.warn方法的典型用法代碼示例。如果您正苦於以下問題:Java Log.warn方法的具體用法?Java Log.warn怎麽用?Java Log.warn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mortbay.log.Log
的用法示例。
在下文中一共展示了Log.warn方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: notifyURLOnce
import org.mortbay.log.Log; //導入方法依賴的package包/類
/**
* Notify the URL just once. Use best effort.
*/
protected boolean notifyURLOnce() {
boolean success = false;
try {
Log.info("Job end notification trying " + urlToNotify);
HttpURLConnection conn =
(HttpURLConnection) urlToNotify.openConnection(proxyToUse);
conn.setConnectTimeout(timeout);
conn.setReadTimeout(timeout);
conn.setAllowUserInteraction(false);
if(conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
Log.warn("Job end notification to " + urlToNotify +" failed with code: "
+ conn.getResponseCode() + " and message \"" + conn.getResponseMessage()
+"\"");
}
else {
success = true;
Log.info("Job end notification to " + urlToNotify + " succeeded");
}
} catch(IOException ioe) {
Log.warn("Job end notification to " + urlToNotify + " failed", ioe);
}
return success;
}
示例2: cleanUpConnectors
import org.mortbay.log.Log; //導入方法依賴的package包/類
private void cleanUpConnectors()
{
Iterator<Map.Entry<String, Connector>> it = _connectors.entrySet().iterator();
while (it.hasNext())
{
Map.Entry<String, Connector> entry = (Map.Entry<String, Connector>) it.next();
Connector connector = entry.getValue();
try
{
connector.stop();
} catch (Exception ex)
{
Log.warn(ex);
}
_server.removeConnector(connector);
}
_connectors.clear();
}
示例3: Publish
import org.mortbay.log.Log; //導入方法依賴的package包/類
Publish()
{
super("publish");
synchronized (_outQ)
{
if (_outQ.size()==0)
return;
setMessages(_outQ);
_outQ.clear();
}
try
{
customize(this);
_client.send(this);
}
catch (IOException e)
{
Log.warn(e);
}
}
示例4: addSession
import org.mortbay.log.Log; //導入方法依賴的package包/類
public void addSession(HttpSession session)
{
if (session == null)
return;
synchronized (_sessionIds)
{
if (session instanceof GigaSessionManager.Session)
{
String id = ((GigaSessionManager.Session)session).getClusterId();
try
{
Id theId = new Id(id);
add(theId);
_sessionIds.add(theId);
if (Log.isDebugEnabled()) Log.debug("Added id "+id);
}
catch (Exception e)
{
Log.warn("Problem storing session id="+id, e);
}
}
else
throw new IllegalStateException ("Session is not a Gigaspaces session");
}
}
示例5: idInUse
import org.mortbay.log.Log; //導入方法依賴的package包/類
public boolean idInUse(String id)
{
if (id == null)
return false;
String clusterId = getClusterId(id);
Id theId = new Id(clusterId);
synchronized (_sessionIds)
{
if (_sessionIds.contains(theId))
return true; //optimisation - if this session is one we've been managing, we can check locally
//otherwise, we need to go to the space to check
try
{
return exists(theId);
}
catch (Exception e)
{
Log.warn("Problem checking inUse for id="+clusterId, e);
return false;
}
}
}
示例6: removeSession
import org.mortbay.log.Log; //導入方法依賴的package包/類
public void removeSession (String id)
{
if (id == null)
return;
synchronized (_sessionIds)
{
if (Log.isDebugEnabled())
Log.debug("Removing session id="+id);
try
{
Id theId = new Id(id);
_sessionIds.remove(theId);
delete(theId);
}
catch (Exception e)
{
Log.warn("Problem removing session id="+id, e);
}
}
}
示例7: unregister
import org.mortbay.log.Log; //導入方法依賴的package包/類
/**
* Unregisters consumer by message name.
* Stops server in case if all consumers are unregistered and default consumer is absent or stopped.
*
* @param messageName message name
* @return true if all consumers are unregistered and defaultConsumer is absent or null.
* It means that this responder can be unregistered.
*/
public boolean unregister(String messageName) {
if (!StringUtils.isEmpty(messageName)) {
if (consumerRegistry.remove(messageName) == null) {
Log.warn("Consumer with message name " + messageName + " was already unregistered.");
}
} else {
defaultConsumer = null;
}
if ((defaultConsumer == null) && (consumerRegistry.isEmpty())) {
if (server != null) {
server.close();
}
return true;
}
return false;
}
示例8: setMessages
import org.mortbay.log.Log; //導入方法依賴的package包/類
protected void setMessages(Queue<Message> messages)
{
try
{
for (Message msg : messages)
{
msg.put(Bayeux.CLIENT_FIELD,_clientId);
}
String json=JSON.toString(messages);
if (_formEncoded)
setRequestContent(new ByteArrayBuffer("message="+URLEncoder.encode(json,"utf-8")));
else
setRequestContent(new ByteArrayBuffer(json,"utf-8"));
}
catch (Exception e)
{
Log.warn(e);
}
}
示例9: getContainerLogDirs
import org.mortbay.log.Log; //導入方法依賴的package包/類
static List<File> getContainerLogDirs(ContainerId containerId,
LocalDirsHandlerService dirsHandler) {
List<String> logDirs = dirsHandler.getLogDirs();
List<File> containerLogDirs = new ArrayList<File>(logDirs.size());
for (String logDir : logDirs) {
try {
logDir = new URI(logDir).getPath();
} catch (URISyntaxException e) {
Log.warn(e.getMessage());
}
String appIdStr = ConverterUtils.toString(containerId
.getApplicationAttemptId().getApplicationId());
File appLogDir = new File(logDir, appIdStr);
String containerIdStr = ConverterUtils.toString(containerId);
containerLogDirs.add(new File(appLogDir, containerIdStr));
}
return containerLogDirs;
}
示例10: getMaxLength
import org.mortbay.log.Log; //導入方法依賴的package包/類
private int getMaxLength(ValueType type, int maxValueLength) {
if ((type == ValueType.Int || type == ValueType.Float) && maxValueLength != 4) {
Log.warn("With integer or float datatypes, the maxValueLength has to be 4 bytes");
return 4;
}
if ((type == ValueType.Double || type == ValueType.Long) && maxValueLength != 8) {
Log.warn("With Double and Long datatypes, the maxValueLength has to be 8 bytes");
return 8;
}
if ((type == ValueType.Short || type == ValueType.Char) && maxValueLength != 2) {
Log.warn("With Short and Char datatypes, the maxValueLength has to be 2 bytes");
return 2;
}
if (type == ValueType.Byte && maxValueLength != 1) {
Log.warn("With Byte datatype, the maxValueLength has to be 1 bytes");
return 1;
}
if (type == ValueType.String && maxValueLength == 0) {
Log.warn("With String datatype, the minimun value length is 2");
maxValueLength = 2;
}
return maxValueLength;
}
示例11: reverseKey
import org.mortbay.log.Log; //導入方法依賴的package包/類
/**
* Builds the reverseKey to fetch the pcaps in the reverse traffic
* (destination to source).
*
* @param key
* indicates hbase rowKey (partial or full) in the format
* "srcAddr-dstAddr-protocol-srcPort-dstPort-fragment"
* @return String indicates the key in the format
* "dstAddr-srcAddr-protocol-dstPort-srcPort"
*/
public static String reverseKey(String key) {
Assert.hasText(key, "key must not be null or empty");
String delimeter = HBaseConfigConstants.PCAP_KEY_DELIMETER;
String regex = "\\" + delimeter;
StringBuffer sb = new StringBuffer();
try {
String[] tokens = key.split(regex);
Assert
.isTrue(
(tokens.length == 5 || tokens.length == 6 || tokens.length == 7),
"key is not in the format : 'srcAddr-dstAddr-protocol-srcPort-dstPort-{ipId-fragment identifier}'");
sb.append(tokens[1]).append(delimeter).append(tokens[0])
.append(delimeter).append(tokens[2]).append(delimeter)
.append(tokens[4]).append(delimeter).append(tokens[3]);
} catch (Exception e) {
Log.warn("Failed to reverse the key. Reverse scan won't be performed.", e);
}
return sb.toString();
}
示例12: reinit
import org.mortbay.log.Log; //導入方法依賴的package包/類
/**
* reinit the compressor with the given configuration. It will reset the
* compressor's compression level and compression strategy. Different from
* <tt>ZlibCompressor</tt>, <tt>BuiltInZlibDeflater</tt> only support three
* kind of compression strategy: FILTERED, HUFFMAN_ONLY and DEFAULT_STRATEGY.
* It will use DEFAULT_STRATEGY as default if the configured compression
* strategy is not supported.
*/
@Override
public void reinit(Configuration conf) {
reset();
if (conf == null) {
return;
}
setLevel(ZlibFactory.getCompressionLevel(conf).compressionLevel());
final ZlibCompressor.CompressionStrategy strategy =
ZlibFactory.getCompressionStrategy(conf);
try {
setStrategy(strategy.compressionStrategy());
} catch (IllegalArgumentException ill) {
Log.warn(strategy + " not supported by BuiltInZlibDeflater.");
setStrategy(DEFAULT_STRATEGY);
}
Log.debug("Reinit compressor with new compression configuration");
}
示例13: validate
import org.mortbay.log.Log; //導入方法依賴的package包/類
public static boolean validate(
final URL file ) {
try (Scanner scanner = new Scanner(
file.openStream(),
StringUtils.GEOWAVE_CHAR_SET.toString())) {
if (scanner.hasNextLine()) {
final String line = scanner.nextLine();
return line.split(",").length == 4;
}
}
catch (final Exception e) {
Log.warn(
"Error validating file: " + file.getPath(),
e);
return false;
}
return false;
}
示例14: complete
import org.mortbay.log.Log; //導入方法依賴的package包/類
/**
* Exit from session
*
* If the session attributes changed then always write the session
* to the cloud.
*
* If just the session access time changed, we don't always write out the
* session, because the gigaspace will serialize the unchanged sesssion
* attributes. To save on serialization overheads, we only write out the
* session when only the access time has changed if the time at which we
* last saved the session exceeds the chosen save interval.
*
* @see org.mortbay.jetty.servlet.AbstractSessionManager.Session#complete()
*/
protected void complete()
{
super.complete();
try
{
if (_dirty || (_data._accessed - _data._lastSaved) >= (_savePeriodMs))
{
_data.setLastSaved(System.currentTimeMillis());
willPassivate();
update(_data);
didActivate();
if (Log.isDebugEnabled()) Log.debug("Dirty="+_dirty+", accessed-saved="+_data._accessed +"-"+ _data._lastSaved+", savePeriodMs="+_savePeriodMs);
}
}
catch (Exception e)
{
Log.warn("Problem persisting changed session data id="+getId(), e);
}
finally
{
_dirty=false;
}
}
示例15: addSession
import org.mortbay.log.Log; //導入方法依賴的package包/類
protected void addSession(org.mortbay.jetty.servlet.AbstractSessionManager.Session abstractSession)
{
if (abstractSession==null)
return;
if (!(abstractSession instanceof GigaSessionManager.Session))
throw new IllegalStateException("Not a GigaspacesSessionManager.Session "+abstractSession);
synchronized (this)
{
GigaSessionManager.Session session = (GigaSessionManager.Session)abstractSession;
try
{
_sessions.put(getClusterId(session), session);
add(session._data);
}
catch (Exception e)
{
Log.warn("Problem writing new SessionData to space ", e);
}
}
}