Here are the examples of the java api org.apache.log4j.Logger.warn() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2239 Examples
19
Source : Log.java
with Apache License 2.0
from zhengshuheng
with Apache License 2.0
from zhengshuheng
public void warn(String message) {
logger.warn(message);
}
19
Source : LoggerUtil.java
with Apache License 2.0
from zhangliangming
with Apache License 2.0
from zhangliangming
public void w(String str) {
String name = getFunctionName();
if (logFlag) {
if (name != null) {
// Log.w(tag, name + " - " + str);
logger.warn(name + " - " + str);
} else {
// Log.w(tag, str);
logger.warn(str.toString());
}
}
}
19
Source : MyLogger.java
with MIT License
from zazaluMonster
with MIT License
from zazaluMonster
public static void warning(String log) {
logger.warn(log);
}
19
Source : UserManager.java
with GNU General Public License v3.0
from yogeshsd
with GNU General Public License v3.0
from yogeshsd
public User getUser(String username) {
logger.debug("Getting details for user " + username);
for (User user : users) {
if (user.getUsername().equalsIgnoreCase(username)) {
logger.debug("Returning details " + user + " for user " + username);
return user;
}
}
logger.warn("Unable to find details for user " + username);
return null;
}
19
Source : ConnectionManager.java
with GNU General Public License v3.0
from yogeshsd
with GNU General Public License v3.0
from yogeshsd
public ConnectionParams getConnectionParams(String alias) {
logger.debug("Getting connection params for alias " + alias);
ConnectionParams defConnParam = null;
boolean isFirst = true;
for (ConnectionParams connectionParams : connParams) {
if (isFirst) {
defConnParam = connectionParams;
isFirst = false;
}
if (connectionParams.getAlias().equalsIgnoreCase(alias) || (connectionParams.getIsDefault().equalsIgnoreCase("true") && alias.equalsIgnoreCase("default"))) {
logger.debug("Returning connection params [" + connectionParams + "] for alias " + alias);
return connectionParams;
}
}
if (alias.equalsIgnoreCase("default"))
return defConnParam;
logger.warn("No connection params defined against alias " + alias);
return null;
}
19
Source : MinaClientHandler.java
with Apache License 2.0
from xuwujing
with Apache License 2.0
from xuwujing
@Override
public void messageReceived(IoSession session, Object message) throws Exception {
String msg = message.toString();
logger.info("客户端接收的数据:" + msg);
// if(msg.equals(XiaoaiConstant.CMD_HEARTBEAT_REQUEST)){
logger.warn("成功收到心跳包");
// session.write(XiaoaiConstant.CMD_HEARTBEAT_RESPONSE);
// }
}
19
Source : tar_5.java
with GNU General Public License v2.0
from xgdsmileboy
with GNU General Public License v2.0
from xgdsmileboy
public void visitEnd() {
if (instrument && clreplacedData.getNumberOfValidLines() == 0)
logger.warn("No line number information found for clreplaced " + this.myName + ". Perhaps you need to compile with debug=true?");
}
19
Source : AzkabanAppjointLog.java
with Apache License 2.0
from WeBankFinTech
with Apache License 2.0
from WeBankFinTech
@Override
public void warn(Object message, Throwable t) {
log.warn(message, t);
}
19
Source : EMFHelper.java
with Eclipse Public License 1.0
from viatra
with Eclipse Public License 1.0
from viatra
/**
* Retrieves the root EObject from a Resource or ResourceSet.
* <ul>
* <li>Returns null if there is no content.</li>
* <li>Returns the notifier itself if it is an EObject.</li>
* <li>Logs a warn if there are multiple roots.</li>
* </ul>
*
* @param notifier
* @return The root EObject or null.
*/
public static EObject getRootEObject(Notifier notifier) {
if (notifier instanceof EObject) {
return (EObject) notifier;
} else if (notifier instanceof Resource) {
Resource resource = (Resource) notifier;
List<EObject> contents = resource.getContents();
if (contents.size() > 1) {
logger.warn("Resource has more than one root.");
}
if (contents.isEmpty()) {
return null;
} else {
return contents.get(0);
}
} else if (notifier instanceof ResourceSet) {
ResourceSet resourceSet = (ResourceSet) notifier;
List<Resource> resources = resourceSet.getResources();
if (resources.size() > 1) {
logger.warn("ResourceSet has more than one resources.");
}
if (resources.isEmpty()) {
return null;
} else {
return getRootEObject(resources.get(0));
}
} else {
throw new EmfHelperException("Unkown type: " + notifier.getClreplaced());
}
}
19
Source : DefaultEbicsLogger.java
with GNU Lesser General Public License v2.1
from uwemaurer
with GNU Lesser General Public License v2.1
from uwemaurer
@Override
public void warn(String message, Throwable throwable) {
logger.warn(message, throwable);
}
19
Source : DefaultEbicsLogger.java
with GNU Lesser General Public License v2.1
from uwemaurer
with GNU Lesser General Public License v2.1
from uwemaurer
@Override
public void warn(String message) {
logger.warn(message);
}
19
Source : InetPacketSender.java
with Apache License 2.0
from usdot-jpo-ode
with Apache License 2.0
from usdot-jpo-ode
/**
* Forward packet. Intended client is the forwarder that received a packet
* @param inbound UDP packet
* @throws InetPacketException
*/
public void forward(DatagramPacket packet) throws InetPacketException {
if (packet == null) {
log.warn("Ignoring forward request for null packet");
return;
}
if (frwdPoint == null)
throw new InetPacketException("Couldn't forward packet. Reason: Forwarding destination is not defined.");
send(frwdPoint, new InetPacket(packet).getBundle());
}
19
Source : InetPacketSender.java
with Apache License 2.0
from usdot-jpo-ode
with Apache License 2.0
from usdot-jpo-ode
/**
* Forward payload to be sent to dstPoint. Intended clients are Transport or Data Sink sending via forwarder
* @param dstPoint destination address and port for forwarder to forward to
* @param payload data to forward
* @throws InetPacketException
*/
public void forward(InetPoint dstPoint, byte[] payload) throws InetPacketException {
if (dstPoint == null || payload == null)
throw new InetPacketException(INVALID_PARAMETERS_MSG);
if (frwdPoint == null)
log.warn("Couldn't forward packet. Reason: Forwarding destination is not defined.");
if (frwdPoint != null && (dstPoint.isIPv6Address() || isForwardAll())) {
send(frwdPoint, new InetPacket(dstPoint, payload).getBundle());
} else {
log.debug("Using direct send instead of forwarding");
send(dstPoint, payload);
}
}
19
Source : InetPacketSender.java
with Apache License 2.0
from usdot-jpo-ode
with Apache License 2.0
from usdot-jpo-ode
/**
* Send packet. Intended client is the forwarder that sends outbound packet
* @param packet outbound packet that contains destination+payload bundle
* @throws InetPacketException
*/
public void send(DatagramPacket packet) throws InetPacketException {
if (packet == null) {
log.warn("Ignoring send request for null packet");
return;
}
InetPacket p = new InetPacket(packet);
InetPoint point = p.getPoint();
if (point == null)
throw new InetPacketException("Couldn't send packet. Reason: Destination is not defined in the packet (not a bundle?)");
send(point, p.getPayload());
}
19
Source : DateUtil.java
with Apache License 2.0
from ucarGroup
with Apache License 2.0
from ucarGroup
/**
* 得到指定日期是星期几
*
* @param value 格式: yyyyMMdd
* @return int 星期天:7,星期一:1,星期二:2,星期三:3,星期四:4,星期五:5,星期六:6
*/
public static int getDayOfWeek(String value) {
int w = WEEK[0];
Date date = null;
try {
date = dateFormat.get().parse(value);
} catch (ParseException e) {
logger.warn(value + " parse \"yyyyMMdd\" fail", e);
}
if (date != null) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
w = WEEK[calendar.get(Calendar.DAY_OF_WEEK)];
}
return w;
}
19
Source : DateUtil.java
with Apache License 2.0
from ucarGroup
with Apache License 2.0
from ucarGroup
private static String addTime(String value, int field, int amount) {
String result = null;
Date date = null;
try {
date = datetimeFormat.get().parse(value);
} catch (ParseException e) {
logger.warn(value + " parse \"yyyyMMdd\" fail", e);
}
if (date != null) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(field, amount);
result = datetimeFormat.get().format(calendar.getTime());
}
return result;
}
19
Source : MLContext.java
with Apache License 2.0
from tugraz-isds
with Apache License 2.0
from tugraz-isds
/**
* Obtain information about the project such as version and build time from
* the manifest in the SystemDS jar file.
*
* @return information about the project
*/
public ProjectInfo info() {
try {
ProjectInfo projectInfo = ProjectInfo.getProjectInfo();
return projectInfo;
} catch (Exception e) {
log.warn("Project information not available");
return null;
}
}
19
Source : DialogueBoxController.java
with GNU General Public License v3.0
from Trilarion
with GNU General Public License v3.0
from Trilarion
/**
* @param stationNumber
*/
public void showStationInfo(int stationNumber) {
try {
stationInfo.setStation(stationNumber);
showContent(stationInfo);
} catch (NoSuchElementException e) {
logger.warn("Station " + stationNumber + " does not exist!");
}
}
19
Source : ModularSqrt31.java
with GNU General Public License v3.0
from TilmanNeumann
with GNU General Public License v3.0
from TilmanNeumann
/**
* Compute the modular sqrt t with t^2 == n (mod p).
* Uses Tonelli-Shanks algorithm for p==1 (mod 8), Lagrange's formula for p==3, 7 (mod 8) and another special formula for p==5 (mod 8).
*
* @param n a positive integer having Jacobi(n|p) = 1
* @param p odd prime
* @return (the smaller) sqrt of n (mod p)
*/
public int modularSqrt(int n, int p) {
if (DEBUG) {
BigInteger p_big = BigInteger.valueOf(p);
// p odd prime
replacedertTrue(p % 2 == 1 && p_big.isProbablePrime(20));
// Tonelli_Shanks requires Legendre(n|p)==1, 0 is not ok. But this is easy to "heal":
// Since p is prime, Legendre(n|p)==0 means that n is a multiple of p.
// Thus n mod p == 0 and the square of this is 0, too.
// So if the following replacedert fails, just test n mod p == 0 before calling this method.
replacedertTrue(jacobiEngine.jacobiSymbol(n, p) == 1);
}
int pMod8 = p & 7;
switch(pMod8) {
case 1:
return Tonelli_Shanks(n, p);
case 3:
case 7:
return Lagrange(n, p);
case 5:
return case5Mod8(n, p);
default:
// p=2 is no problem
if (p > 2)
LOG.warn("Tonelli_Shanks() has been called with even p=" + p + " -> brute force search required.");
return bruteForce(n, p);
}
}
19
Source : ModularSqrt.java
with GNU General Public License v3.0
from TilmanNeumann
with GNU General Public License v3.0
from TilmanNeumann
/**
* Compute the modular sqrt t with t^2 == n (mod p).
* Uses Tonelli-Shanks algorithm for p==1 (mod 8), Lagrange's formula for p==3, 7 (mod 8) and another special formula for p==5 (mod 8).
*
* @param n a positive integer having Jacobi(n|p) = 1
* @param p odd prime
* @return the modular sqrt t
*/
public int modularSqrt(BigInteger n, int p) {
if (DEBUG) {
BigInteger p_big = BigInteger.valueOf(p);
// p odd prime
replacedertTrue(p % 2 == 1 && p_big.isProbablePrime(20));
// Tonelli_Shanks requires Legendre(n|p)==1, 0 is not ok. But this is easy to "heal":
// Since p is prime, Legendre(n|p)==0 means that n is a multiple of p.
// Thus n mod p == 0 and the square of this is 0, too.
// So if the following replacedert fails, just test n mod p == 0 before calling this method.
replacedertTrue(jacobiEngine.jacobiSymbol(n, p) == 1);
}
int pMod8 = p & 7;
switch(pMod8) {
case 1:
return Tonelli_Shanks(n, p);
case 3:
case 7:
return Lagrange(n, p);
case 5:
return case5Mod8(n, p);
default:
LOG.warn("Tonelli_Shanks() has been called with even p=" + p + " -> brute force search required.");
return bruteForce(n, p);
}
}
19
Source : TinyEcm64_MontSqr.java
with GNU General Public License v3.0
from TilmanNeumann
with GNU General Public License v3.0
from TilmanNeumann
EcmResult tinyecm(long n, int B1, int curves) {
// attempt to factor n with the elliptic curve method
// following brent and montgomery's papers, and CP's book
int curve;
long result;
ecm_work work = new ecm_work();
ecm_pt P = new ecm_pt();
int sigma;
long rho, x;
// here x*a==1 mod 2**4
x = (((n + 2) & 4) << 1) + n;
// here x*a==1 mod 2**8
x *= 2 - n * x;
// here x*a==1 mod 2**16
x *= 2 - n * x;
// here x*a==1 mod 2**32
x *= 2 - n * x;
// here x*a==1 mod 2**64
x *= 2 - n * x;
rho = (long) 0 - x;
if (DEBUG)
LOG.debug("rho = " + Long.toUnsignedString(rho));
work.n = n;
work.stg1_max = B1;
// pre-paired sequences have been prepared for this B2, so it is not an input
for (curve = 0; curve < curves; curve++) {
if (DEBUG)
LOG.debug("curve=" + curve);
sigma = 0;
if (DEBUG)
LOG.debug("1: P.X=" + P.X + ", P.Z=" + P.Z);
build(P, rho, work, sigma);
if (DEBUG)
LOG.debug("curve=" + curve + ": build finished");
if (DEBUG)
LOG.debug("2: P.X=" + P.X + ", P.Z=" + P.Z);
P = ecm_stage1(rho, work, P);
if (DEBUG)
LOG.debug("curve=" + curve + ": stage1 finished");
if (DEBUG)
LOG.debug("3: P.X=" + P.X + ", P.Z=" + P.Z);
result = check_factor(P.Z, n);
if (result > 1) {
return new EcmResult(result, curve + 1);
}
ecm_stage2(P, rho, work);
if (DEBUG)
LOG.debug("curve=" + curve + ": stage2 finished");
if (DEBUG)
LOG.debug("4: P.X=" + P.X + ", P.Z=" + P.Z);
result = check_factor(work.stg2acc, n);
if (result > 1) {
return new EcmResult(result, curve + 1);
}
}
if (DEBUG)
LOG.warn("Failed to find a factor of N=" + n);
return new EcmResult(1, curve);
}
19
Source : PrimeBaseGenerator.java
with GNU General Public License v3.0
from TilmanNeumann
with GNU General Public License v3.0
from TilmanNeumann
/**
* Compute a reduced prime base containing the 2 and odd primes p with Jacobi(kN|p)>=0
*
* @param kN has to be a quadratic residue modulo all p
* @param primeBaseSize the wanted number of primes
* @param primesArray is filled with the primes p satisfying Jacobi(kN|p)>=0
*/
public void computeReducedPrimeBase(BigInteger kN, int primeBaseSize, int[] primesArray) {
// the 2 is always added
primesArray[0] = 2;
// odd primes
int count = 1;
for (int i = 1; ; i++) {
int p = rawPrimesArray.getPrime(i);
int jacobi = jacobiEngine.jacobiSymbol(kN, p);
if (DEBUG) {
// ensure correctness of prime generator
replacedertTrue(BigInteger.valueOf(p).isProbablePrime(20));
// ensure that Jacobi symbol values are in the expected range -1 ... +1
if (jacobi < -1 || jacobi > 1)
LOG.warn("kN=" + kN + ", p=" + p + " -> jacobi=" + jacobi);
}
// Q(x) = A(x)^2 - kN can only be divisible by p with Legendre(kN|p) >= 0.
// It is important to add p with Legendre(kN|p) == 0, too! Otherwise we would not find such p during trial division.
// On the other hand, doing a factor test here in that case makes no sense,
// because it is typically caused by k, and we will find such factors during trial division anyway.
if (jacobi >= 0) {
// kN is a quadratic residue mod p (or not coprime)
primesArray[count] = p;
// if not null, then fill primesArray_big, too
if (++count == primeBaseSize)
break;
}
}
}
19
Source : AParamGenerator01.java
with GNU General Public License v3.0
from TilmanNeumann
with GNU General Public License v3.0
from TilmanNeumann
@Override
public BigInteger computeNextAParameter() {
@SuppressWarnings("unused")
int duplicateACount = 0;
while (true) {
this.computeAParameter();
// a new "a"
if (!aParamHistory.contains(a))
break;
duplicateACount++;
if (DEBUG)
LOG.warn("New a-parameter #" + aParamHistory.size() + ": a=" + a + " has already been used! #(duplicate a in a row) = " + duplicateACount);
}
aParamHistory.add(a);
return a;
}
19
Source : ModularSqrt.java
with GNU General Public License v3.0
from TilmanNeumann
with GNU General Public License v3.0
from TilmanNeumann
/**
* Tonelli-Shanks implementation for the modular sqrt t with t^2 == a (mod p).
*
* @param a
* @param p
* @return t
*/
public int Tonelli_Shanks(BigInteger a, int p) {
if (DEBUG) {
BigInteger p_big = BigInteger.valueOf(p);
// p odd prime
replacedertTrue(p % 2 == 1 && p_big.isProbablePrime(20));
// Tonelli_Shanks requires Legendre(kN|p)==1, 0 is not ok. But this is easy to "heal":
// Since p is prime, Legendre(kN|p)==0 means that kN is a multiple of p.
// Thus kN mod p == 0 and the square of this is 0, too.
// So if the following replacedert fails, just test kN mod p == 0 before calling this method.
replacedertTrue(jacobiEngine.jacobiSymbol(a, p) == 1);
}
int pMod8 = p & 7;
switch(pMod8) {
case 1:
return Tonelli_Shanks_internal(a, p);
case 3:
case 7:
return Lagrange(a, p);
case 5:
return case5Mod8(a, p);
default:
LOG.warn("Tonelli_Shanks() has been called with even p=" + p + " -> brute force search required.");
return bruteForce(a, p);
}
}
19
Source : SwitchService.java
with Apache License 2.0
from telstra
with Apache License 2.0
from telstra
/**
* Gets port flows.
*
* @param switchId the switch id
* @param port the port
* @return the customers detail
* @throws AccessDeniedException the access denied exception
*/
public ResponseEnreplacedy<List<?>> getPortFlows(String switchId, String port, boolean inventory) throws AccessDeniedException {
if (!inventory) {
List<FlowInfo> flowList = switchIntegrationService.getSwitchFlows(switchId, port);
return new ResponseEnreplacedy<List<?>>(flowList, HttpStatus.OK);
}
if (inventory && port != null) {
if (userService.getLoggedInUserInfo().getPermissions().contains(IConstants.Permission.FW_FLOW_INVENTORY)) {
List<Customer> customers = new ArrayList<Customer>();
if (storeService.getSwitchStoreConfig().getUrls().size() > 0) {
try {
customers = switchStoreService.getPortFlows(switchId, port);
} catch (Exception ex) {
LOGGER.warn("Error occured while retreiving port flows.", ex);
throw new StoreIntegrationException("Error occured while retreiving port flows.", ex);
}
}
return new ResponseEnreplacedy<List<?>>(customers, HttpStatus.OK);
}
}
return null;
}
19
Source : AfMain.java
with Apache License 2.0
from Syncleus
with Apache License 2.0
from Syncleus
/**
* starts a benchmark in a separate thread
*/
public void benchmark(final String benchmarkMode) {
if (benchmarkRunning) {
LOG.warn("Benchmark akready running");
return;
}
benchmarkThread = new Thread() {
public void run() {
benchmarkRunning = true;
gui.benchmarkLedOn();
if ("CURRENT".equals(benchmarkMode)) {
/**
* executes the benchmark using current coordinates and max iterations
*/
AfBenchmark.benchmark(afAparapiUtils, false, "CurrentRegion", cx1, cy1, cx2, cy2, W, H, maxIterations, "ALL", 100);
} else {
AfBenchmark.benchmark(afAparapiUtils, benchmarkMode);
}
init();
gui.benchmarkLedOff();
benchmarkRunning = false;
}
};
benchmarkThread.start();
}
19
Source : AfMain.java
with Apache License 2.0
from Syncleus
with Apache License 2.0
from Syncleus
/**
* call the aparapi execution and then refresh the gui
*
* @return calculations elapsed time, not considering gui refreshing time
*/
private synchronized long refresh() {
if (benchmarkRunning) {
LOG.warn("Benchmark in progress...");
return 0;
}
gui.deviceLedOn();
gui.lastMaxIterations = maxIterations;
elapsed = afAparapiUtils.execute(cx1, cy1, cx2, cy2, W + 1, H + 1, maxIterations);
iterations = afAparapiUtils.getResult();
/*
* long totalIterations=0; for(int i=0;i<W;i++) { for(int j=0;j<H;j++) {
* totalIterations+=iterations[i][j]; } }
*
* if(totalIterations<1000) { LOG.fatal("totalIterations:"+totalIterations+
* " very small aborting"); System.exit(1); }
*/
LOG.debug(String.format("%2.16fd,%2.16fd %2.16fd,%2.16fd MaxIterations : %10d - Elapsed : %d ms", cx1, cy1, cx2, cy2, maxIterations, elapsed));
gui.deviceLedOff();
gui.refresh();
return elapsed;
}
19
Source : AfMain.java
with Apache License 2.0
from Syncleus
with Apache License 2.0
from Syncleus
/**
* go to new coordinates using x,y pixel as new center and a zoom factor.
*
* @param x new central pixel x
* @param y new central pixel y
* @param zoomFactor zoomFactor is relative to dimensions in complex plane
*/
public void move(int x, int y, double zoomFactor) {
double nx1 = cx1 + x * (cx2 - cx1) / W;
double ny1 = cy1 + y * (cy2 - cy1) / H;
double cw = zoomFactor * (cx2 - cx1);
double ch = zoomFactor * (cy2 - cy1);
/**
* stop when too small and zooming in *
*/
if ((cw < minXWidth) && (zoomFactor < 1d)) {
LOG.warn(String.format("!!! Zoom limit !!! x range : %2.20f", cw));
gui.mouseWheelZooming = false;
return;
}
/**
* too big or too far, the set is between -2 and 2 *
*/
if (((cw > 10) && (zoomFactor > 1d)) || (nx1 > 5) || (nx1 < -5) || (ny1 > 5) || (ny1 < -5)) {
LOG.warn(String.format("too big or too far, " + zoomFactor));
gui.mouseWheelZooming = false;
return;
}
threadGo(nx1 - 0.5f * cw, ny1 - 0.5f * ch, nx1 + 0.5f * cw, ny1 + 0.5f * ch, 0);
}
19
Source : AfBenchmark.java
with Apache License 2.0
from Syncleus
with Apache License 2.0
from Syncleus
public static void benchmark(AfAparapiUtils afAparapiUtils, String mode) {
if ("SOFT".equals(mode)) {
benchmarkSoft(afAparapiUtils);
} else if ("HARD".equals(mode)) {
benchmarkHard(afAparapiUtils);
} else if ("STRESS".equals(mode)) {
benchmarkStress(afAparapiUtils);
} else if ("LSIZE".equals(mode)) {
benchmarkLocalSizes(afAparapiUtils);
} else {
LOG.warn("Unknown mode : " + mode);
}
}
19
Source : AbstractDBAdapter.java
with GNU General Public License v3.0
from smartmarmot
with GNU General Public License v3.0
from smartmarmot
@Override
public void reconnect() {
LOG.warn("Trying to reconnect...");
abort();
try {
createConnection();
LOG.warn("Reconnected.");
} catch (ClreplacedNotFoundException | SQLException e) {
LOG.warn("Reconnection has failed.");
e.printStackTrace();
try {
LOG.warn("Sleeping 60 seconds...");
Thread.sleep(60000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
19
Source : KafkaMultiDCSourceSynchronizerTestCases.java
with Apache License 2.0
from siddhi-io
with Apache License 2.0
from siddhi-io
private boolean compareEventSequnce(List<Object> expectedEventSequence) {
if (eventsArrived.size() != expectedEventSequence.size()) {
LOG.info("Expected number of events and actual number of events are different. " + "Expected=" + expectedEventSequence.size() + ". Arrived=" + eventsArrived.size());
return false;
}
for (int i = 0; i < expectedEventSequence.size(); i++) {
if (!eventsArrived.get(i).toString().equals(expectedEventSequence.get(i))) {
LOG.warn("Event " + i + " in the expected and arrived events are different." + " Expected=" + expectedEventSequence.get(i).toString() + ", Arrived=" + eventsArrived.get(i).toString());
return false;
}
}
return true;
}
19
Source : Login.java
with Apache License 2.0
from sereca
with Apache License 2.0
from sereca
public void shutdown() {
if ((t != null) && (t.isAlive())) {
t.interrupt();
try {
t.join();
} catch (InterruptedException e) {
LOG.warn("error while waiting for Login thread to shutdown: " + e);
}
}
}
19
Source : Login.java
with Apache License 2.0
from sereca
with Apache License 2.0
from sereca
private boolean hreplacedufficientTimeElapsed() {
long now = Time.currentElapsedTime();
if (now - getLastLogin() < MIN_TIME_BEFORE_RELOGIN) {
LOG.warn("Not attempting to re-login since the last re-login was " + "attempted less than " + (MIN_TIME_BEFORE_RELOGIN / 1000) + " seconds" + " before.");
return false;
}
// register most recent relogin attempt
setLastLogin(now);
return true;
}
19
Source : Config.java
with MIT License
from Scrin
with MIT License
from Scrin
private static void validateConfig() {
if (FILTER_INFLUXDB_FIELDS.isEmpty()) {
switch(storageValues) {
case "whitelist":
throw new IllegalStateException("You have selected no fields to be stored into the InfluxDB. " + "Please set the storage.values.list property or select another storage.values option. " + "See MEASUREMENTS.md for the available fields and ruuvi-collector.properties.example for " + "the possible values of the storage.values property.");
case "blacklist":
LOG.warn("You have set storage.values=blacklist but left storage.values.list empty. " + "This is essentially the same as setting storage.values=extended. If this is intentional, " + "you may ignore this message.");
break;
}
}
}
19
Source : Config.java
with MIT License
from Scrin
with MIT License
from Scrin
private static void readConfig() {
try {
final File configFile = configFileFinder.apply(RUUVI_COLLECTOR_PROPERTIES);
if (configFile != null) {
LOG.debug("Config: " + configFile);
Properties props = new Properties();
props.load(new InputStreamReader(new FileInputStream(configFile), Charset.forName("UTF-8")));
readConfigFromProperties(props);
}
} catch (IOException ex) {
LOG.warn("Failed to read configuration, using default values...", ex);
}
}
19
Source : AriesLogNative.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
// Must synchronize because multiple sites might insert into the log
// concurrently
@Override
public synchronized void log(byte[] logbytes, AtomicBoolean isDurable) {
LogDataWithAtom atom = new LogDataWithAtom(logbytes, isDurable);
LOG.warn("AriesLogNative : log add atom :: size :" + m_waitingToFlush.size());
// totalLogSize += logbytes.length;
// numTransactions++;
// Must lock further to avoid insertions during a list swap.
synchronized (this) {
m_waitingToFlush.add(atom);
}
}
19
Source : Workload.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
@Override
public void abortTransaction(Object xact_handle) {
if (xact_handle instanceof TransactionTrace) {
TransactionTrace txn_trace = (TransactionTrace) xact_handle;
// Abort any open queries
for (QueryTrace query : txn_trace.getQueries()) {
if (query.isStopped() == false) {
query.abort();
this.query_txn_xref.remove(query);
}
}
// FOR
txn_trace.abort();
if (debug.val)
LOG.debug("Aborted trace for transaction " + txn_trace);
// Write the trace object out to our file if it is not null
if (this.catalog_db == null) {
LOG.warn("The database catalog handle is null: " + txn_trace);
} else {
if (this.out == null) {
if (debug.val)
LOG.warn("No output path is set. Unable to log trace information to file");
} else {
writeTransactionToStream(this.catalog_db, txn_trace, this.out);
}
}
} else {
LOG.fatal("Unable to abort transaction trace: Invalid transaction handle");
}
}
19
Source : Workload.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
/**
* @param txn_id
*/
@Override
public void stopTransaction(Object xact_handle, VoltTable... result) {
if (xact_handle instanceof TransactionTrace) {
TransactionTrace txn_trace = (TransactionTrace) xact_handle;
// Make sure we have stopped all of our queries
boolean unclean = false;
for (QueryTrace query : txn_trace.getQueries()) {
if (!query.isStopped()) {
if (debug.val)
LOG.warn("Trace for '" + query + "' was not stopped before the transaction. replaceduming it was aborted");
query.aborted = true;
unclean = true;
}
}
// FOR
if (unclean)
LOG.warn("The entries in " + txn_trace + " were not stopped cleanly before the transaction was stopped");
// Mark the txn as stopped
txn_trace.stop();
if (result != null)
txn_trace.setOutput(result);
// Remove from internal cache data structures
this.removeTransaction(txn_trace);
if (debug.val)
LOG.debug("Stopping trace for transaction " + txn_trace);
} else {
LOG.fatal("Unable to stop transaction trace: Invalid transaction handle");
}
// Write the trace object out to our file if it is not null
if (xact_handle != null && xact_handle instanceof TransactionTrace) {
TransactionTrace xact = (TransactionTrace) xact_handle;
if (this.catalog_db == null) {
LOG.warn("The database catalog handle is null: " + xact);
} else {
if (this.out == null) {
if (debug.val)
LOG.warn("No output path is set. Unable to log trace information to file");
} else {
writeTransactionToStream(this.catalog_db, xact, this.out);
}
}
}
return;
}
19
Source : FileUtil.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
public static String realpath(String path) {
File f = new File(path);
String ret = null;
try {
ret = f.getCanonicalPath();
} catch (Exception ex) {
LOG.warn(ex);
}
return (ret);
}
19
Source : MarkovGraphsContainer.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
/**
* Get or create the MarkovGraph for the given id/procedure pair
* If initialize is set to true, then when we have to create the graph we will call initialize()
* @param id
* @param catalog_proc
* @param initialize
* @return
*/
public MarkovGraph getOrCreate(Integer id, Procedure catalog_proc, boolean initialize) {
MarkovGraph markov = this.get(id, catalog_proc);
if (markov == null) {
synchronized (this) {
markov = this.get(id, catalog_proc);
if (markov == null) {
if (debug.val)
LOG.warn(String.format("Creating a new %s MarkovGraph for id %d", catalog_proc.getName(), id));
markov = new MarkovGraph(catalog_proc);
if (initialize)
markov.initialize();
this.put(id, markov);
}
}
// SYNCH
}
return (markov);
}
19
Source : MarkovGraphsContainer.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
/**
* @param txn_id
* @param base_parreplacedion
* @param params
* @param catalog_proc
* @return
*/
public MarkovGraph getFromParams(Long txn_id, int base_parreplacedion, Object[] params, Procedure catalog_proc) {
replacedert (catalog_proc != null);
MarkovGraph m = this.getOrCreate(base_parreplacedion, catalog_proc, true);
if (m == null) {
LOG.warn(String.format("Failed to find MarkovGraph for %s txn #%d [base_parreplacedion=%d, params=%s]", catalog_proc.getName(), txn_id, base_parreplacedion, Arrays.toString(params)));
LOG.warn("MarkovGraphsContainer Dump:\n" + this);
}
return (m);
}
19
Source : MapReduceTransaction.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
// ----------------------------------------------------------------------------
// ACCESS METHODS
// ----------------------------------------------------------------------------
@Override
public boolean isDeletable() {
if (this.cleanup_callback.allCallbacksFinished() == false) {
if (trace.val)
LOG.warn(String.format("%s - %s is not finished", this, this.cleanup_callback.getClreplaced().getSimpleName()));
return (false);
}
return (super.isDeletable());
}
19
Source : LocalTransaction.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
@Override
public boolean isDeletable() {
if (this.init_callback.allCallbacksFinished() == false) {
if (trace.val)
LOG.warn(String.format("%s - %s is not finished", this, this.init_callback.getClreplaced().getSimpleName()));
return (false);
}
if (this.dtxnState != null) {
if (this.dtxnState.prepare_callback.allCallbacksFinished() == false) {
if (trace.val)
LOG.warn(String.format("%s - %s is not finished", this, this.dtxnState.prepare_callback.getClreplaced().getSimpleName()));
return (false);
}
if (this.dtxnState.finish_callback.allCallbacksFinished() == false) {
if (trace.val)
LOG.warn(String.format("%s - %s is not finished", this, this.dtxnState.finish_callback.getClreplaced().getSimpleName()));
return (false);
}
}
if (this.needs_restart) {
if (trace.val)
LOG.warn(String.format("%s - Needs restart, can't delete now", this));
return (false);
}
return (super.isDeletable());
}
19
Source : TransactionInitializer.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
/**
* Register a new LocalTransaction handle with this HStoreSite
* We will return a txnId that is guaranteed to be globally unique
* @param ts
* @param base_parreplacedion
* @return
*/
protected Long registerTransaction(LocalTransaction ts, int base_parreplacedion) {
TransactionIdManager idManager = this.txnIdManagers[base_parreplacedion];
Long txn_id = idManager.getNextUniqueTransactionId();
// For some odd reason we sometimes get duplicate transaction ids from the VoltDB id generator
// So we'll just double check to make sure that it's unique, and if not, we'll just ask for a new one
LocalTransaction dupe = (LocalTransaction) this.inflight_txns.put(txn_id, ts);
if (dupe != null) {
// HACK!
this.inflight_txns.put(txn_id, dupe);
Long new_txn_id = idManager.getNextUniqueTransactionId();
if (new_txn_id.equals(txn_id)) {
String msg = "Duplicate transaction id #" + txn_id;
LOG.fatal("ORIG TRANSACTION:\n" + dupe);
LOG.fatal("NEW TRANSACTION:\n" + ts);
Exception error = new Exception(msg);
this.hstore_site.getCoordinator().shutdownClusterBlocking(error);
}
LOG.warn(String.format("Had to fix duplicate txn ids: %d -> %d", txn_id, new_txn_id));
txn_id = new_txn_id;
this.inflight_txns.put(txn_id, ts);
}
return (txn_id);
}
19
Source : PartitionLockQueue.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
/**
* Update the information stored about the latest transaction
* seen from each initiator. Compute the newest safe transaction id.
*/
public Long noteTransactionRecievedAndReturnLastSafeTxnId(Long txnId) {
replacedert (txnId != null);
if (debug.val)
LOG.debug(String.format("Parreplacedion %d :: noteTransactionRecievedAndReturnLastSeen(%d)", this.parreplacedionId, txnId));
this.lastSeenTxnId = txnId;
if (trace.val) {
LOG.trace(String.format("Parreplacedion %d :: SET lastSeenTxnId = %d", this.parreplacedionId, this.lastSeenTxnId));
LOG.trace(String.format("Parreplacedion %d :: Attempting to acquire lock", this.parreplacedionId));
}
this.lock.lock();
try {
if (this.lastTxnPopped.compareTo(txnId) > 0) {
if (debug.val)
LOG.warn(String.format("Parreplacedion %d :: Txn ordering deadlock --> LastTxn:%d / NewTxn:%d", this.parreplacedionId, this.lastTxnPopped, txnId));
return (this.lastTxnPopped);
}
// We always need to check whether this new txnId is less than our next safe txnID
// If it is, then we know that we need to replace it.
if (txnId.compareTo(this.lastSafeTxnId) < 0) {
// 2013-01-15
// Instead of calling checkQueueState() here, we'll
// just change the state real quickly. This should be ok because
// then we'll immediately insert this new txn into the queue
// and then update the queue state then.
this.state = QueueState.BLOCKED_ORDERING;
this.lastSafeTxnId = txnId;
if (trace.val)
LOG.trace(String.format("Parreplacedion %d :: SET lastSafeTxnId = %d", this.parreplacedionId, this.lastSafeTxnId));
// Since we know that we just replaced the last safeTxnId, we
// need to check our queue state to update ourselves
// this.checkQueueState(false);
}
} finally {
if (trace.val)
LOG.trace(String.format("Parreplacedion %d :: Releasing lock", this.parreplacedionId));
this.lock.unlock();
}
// SYNCH
return (this.lastSafeTxnId);
}
19
Source : AbstractDispatcher.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
protected final void processingCallback(E e) {
try {
this.runImpl(e);
} catch (Throwable ex) {
String dump = null;
if (ClreplacedUtil.isArray(e)) {
dump = Arrays.toString((Object[]) e);
} else if (e != null) {
dump = e.toString();
}
LOG.warn("Failed to process queued element: " + dump, ex);
}
}
19
Source : RemotePrepareCallback.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
@Override
protected void abortCallback(int parreplacedion, Status status) {
// Uh... this might have already been sent out?
if (this.builder != null) {
if (debug.val)
LOG.debug(String.format("%s - Aborting %s with status %s", this.ts, this.getClreplaced().getSimpleName(), status));
// Ok so where's what going on here. We need to send back
// an abort message, so we're going use the builder that we've been
// working on and send out the bomb back to the base parreplacedion tells it that this
// transaction is kaput at this HStoreSite.
this.builder.setStatus(status);
this.builder.clearParreplacedions();
this.builder.addAllParreplacedions(this.getParreplacedions());
replacedert (this.origCallback != null) : String.format("The original callback for %s is null!", this.ts);
this.origCallback.run(this.builder.build());
this.builder = null;
} else if (debug.val) {
LOG.warn(String.format("%s - No builder is available? Unable to send back %s", this.ts, TransactionPrepareResponse.clreplaced.getSimpleName()));
}
}
19
Source : RemoteInitQueueCallback.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
@Override
protected void abortCallback(int parreplacedion, Status status) {
// Uh... this might have already been sent out?
if (this.builder != null) {
if (debug.val)
LOG.debug(String.format("%s - Aborting %s with status %s", this.ts, this.getClreplaced().getSimpleName(), status));
// Ok so where's what going on here. We need to send back
// an abort message, so we're going use the builder that we've been
// working on and send out the bomb back to the base parreplacedion tells it that this
// transaction is kaput at this HStoreSite.
this.builder.setStatus(status);
this.builder.clearParreplacedions();
this.builder.addAllParreplacedions(this.getParreplacedions());
this.builder.setRejectParreplacedion(parreplacedion);
replacedert (this.origCallback != null) : String.format("The original callback for %s is null!", this.ts);
this.origCallback.run(this.builder.build());
this.builder = null;
} else if (debug.val) {
LOG.warn(String.format("%s - No builder is available? Unable to send back %s", this.ts, TransactionInitResponse.clreplaced.getSimpleName()));
}
}
19
Source : AntiCacheManager.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
// ----------------------------------------------------------------------------
// STATIC HELPER METHODS
// ----------------------------------------------------------------------------
/**
* Returns the directory where the EE should store the anti-cache database
* for this ParreplacedionExecutor
* @return
*/
public static File getDatabaseDir(ParreplacedionExecutor executor) {
HStoreConf hstore_conf = executor.getHStoreConf();
Database catalog_db = CatalogUtil.getDatabase(executor.getParreplacedion());
// First make sure that our base directory exists
String base_dir = FileUtil.realpath(hstore_conf.site.anticache_dir + File.separatorChar + catalog_db.getProject());
synchronized (AntiCacheManager.clreplaced) {
FileUtil.makeDirIfNotExists(base_dir);
}
// SYNC
// Then each parreplacedion will have a separate directory inside of the base one
String parreplacedionName = HStoreThreadManager.formatParreplacedionName(executor.getSiteId(), executor.getParreplacedionId());
File dbDirPath = new File(base_dir + File.separatorChar + parreplacedionName);
if (hstore_conf.site.anticache_reset) {
LOG.warn(String.format("Deleting anti-cache directory '%s'", dbDirPath));
FileUtil.deleteDirectory(dbDirPath);
}
FileUtil.makeDirIfNotExists(dbDirPath);
return (dbDirPath);
}
19
Source : Designer.java
with GNU General Public License v3.0
from s-store
with GNU General Public License v3.0
from s-store
/**
*/
private void init() throws Exception {
//
// Step 1: Workload replacedysis
//
for (Procedure catalog_proc : info.catalogContext.database.getProcedures()) {
if (catalog_proc.getSystemproc())
continue;
if ((!this.hints.proc_include.isEmpty() && !this.hints.proc_include.contains(catalog_proc.getName())) || this.hints.proc_exclude.contains(catalog_proc.getName())) {
LOG.debug("Skipping " + catalog_proc);
continue;
}
// Generate a new AccessGraph for this Procedure
LOG.debug("Generating AccessGraph for " + catalog_proc);
AccessGraph agraph = new AccessGraph(info.catalogContext.database);
new AccessGraphGenerator(info, catalog_proc).generate(agraph);
if (agraph.getVertexCount() == 0) {
if (LOG.isDebugEnabled())
LOG.warn("The workload replacedyzer created an AccessGraph for " + catalog_proc + " with no vertices. Skipping...");
continue;
}
this.proc_access_graphs.put(catalog_proc, agraph);
this.proc_graphs.put(catalog_proc, new LinkedHashSet<IGraph<DesignerVertex, DesignerEdge>>());
this.proc_graphs.get(catalog_proc).add(agraph);
}
// FOR
}
See More Examples