code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public R getMatch() {
for (Pattern<T, R> pattern : patterns) {
if (pattern.matches(value)) {
return pattern.apply(value);
}
}
throw new MatchException("No match found for " + value);
} | java |
public void seedUsingPcmAudio(byte[] data) {
byte[] key = new byte[64];
for (int i = 0; i < key.length; i++) {
int x = 0;
//Pick 4 random bytes from the PCM audio data, from each of the bytes
//take the two least significant bits and concatenate them to form
... | java |
public int getInt() {
try {
byte[] rand = fipsGenerator.getBytes(4);
int result = rand[0];
for (int i = 1; i < 4; i++) {
result = (result << 8) | rand[i];
}
return result;
} catch (Throwable ex) {
BBPlatform.getPlatform... | java |
public void getBytes(byte[] buffer) {
try {
fipsGenerator.getBytes(buffer);
} catch (Throwable ex) {
BBPlatform.getPlatform().getLogger().logException("RandomGenerator.getBytes() Falling back to RandomSource... " + ex.getMessage());
RandomSource.getBytes(buffer);
... | java |
protected void checkBuf (int pointCount, boolean checkMove) {
if (checkMove && typeSize == 0) {
throw new IllegalPathStateException("First segment must be a SEG_MOVETO");
}
if (typeSize == types.length) {
byte[] tmp = new byte[typeSize + BUFFER_CAPACITY];
Syst... | java |
protected boolean isInside (int cross) {
return (rule == WIND_NON_ZERO) ? Crossing.isInsideNonZero(cross) :
Crossing.isInsideEvenOdd(cross);
} | java |
public static void subQuad (double[] coef, double t0, boolean left) {
if (left) {
coef[2] = (1 - t0) * coef[0] + t0 * coef[2];
coef[3] = (1 - t0) * coef[1] + t0 * coef[3];
} else {
coef[2] = (1 - t0) * coef[2] + t0 * coef[4];
coef[3] = (1 - t0) * coef[3] +... | java |
private boolean sendResponse(String respondToURL, String payloadType, ResponseWrapper payload) {
// This method will likely need some thought and care in the error handling
// and error reporting
// It's a had job at the moment.
String responseStr = null;
String contentType = null; // MIME type
... | java |
public void run() {
ResponseWrapper response = null;
LOGGER.info("Received probe id: " + probe.getProbeId());
// Only handle probes that we haven't handled before
// The Probe Generator needs to send a stream of identical UDP packets
// to compensate for UDP reliability issues. Therefore, the Res... | java |
protected static int fixRoots (float[] res, int rc) {
int tc = 0;
for (int i = 0; i < rc; i++) {
out: {
for (int j = i + 1; j < rc; j++) {
if (isZero(res[i] - res[j])) {
break out;
}
}
... | java |
public static int intersectQuad (float x1, float y1, float cx, float cy, float x2,
float y2, float rx1, float ry1, float rx2, float ry2) {
// LEFT/RIGHT/UP ------------------------------------------------------
if ((rx2 < x1 && rx2 < cx && rx2 < x2) || (rx1 > x1 && r... | java |
public static int intersectPath (PathIterator p, float x, float y, float w, float h) {
int cross = 0;
int count;
float mx, my, cx, cy;
mx = my = cx = cy = 0f;
float[] coords = new float[6];
float rx1 = x;
float ry1 = y;
float rx2 = x + w;
float ry... | java |
public static int intersectShape (IShape s, float x, float y, float w, float h) {
if (!s.bounds().intersects(x, y, w, h)) {
return 0;
}
return intersectPath(s.pathIterator(null), x, y, w, h);
} | java |
public boolean isExpired() {
if (_service.getTtl() == 0) {
return false;
}
long t = this.cacheStartTime.getTime();
Date validTime = new Date(t + (_service.getTtl() * ONE_MINUTE_IN_MILLIS));
Date now = new Date();
return (now.getTime() > validTime.getTime());
} | java |
public Matrix4 setToTransform (IVector3 translation, IQuaternion rotation) {
return setToRotation(rotation).setTranslation(translation);
} | java |
public Matrix4 setToTranslation (IVector3 translation) {
return setToTranslation(translation.x(), translation.y(), translation.z());
} | java |
public Matrix4 setToRotationScale (IMatrix3 rotScale) {
return set(rotScale.m00(), rotScale.m01(), rotScale.m02(), 0f,
rotScale.m10(), rotScale.m11(), rotScale.m12(), 0f,
rotScale.m20(), rotScale.m21(), rotScale.m22(), 0f,
0, 0, 0, 1);
} | java |
public Matrix4 setToPerspective (double fovy, double aspect, double near, double far) {
double f = 1f / Math.tan(fovy / 2f), dscale = 1f / (near - far);
return set(f/aspect, 0f, 0f, 0f,
0f, f, 0f, 0f,
0f, 0f, (far+near) * dscale, 2f * far * near * dscale,
... | java |
public Matrix4 setToFrustum (
double left, double right, double bottom, double top, double near, double far) {
return setToFrustum(left, right, bottom, top, near, far, Vector3.UNIT_Z);
} | java |
public Matrix4 setToFrustum (
double left, double right, double bottom, double top,
double near, double far, IVector3 nearFarNormal) {
double rrl = 1f / (right - left);
double rtb = 1f / (top - bottom);
double rnf = 1f / (near - far);
double n2 = 2f * near;
double... | java |
public Matrix4 setToOrtho (
double left, double right, double bottom, double top,
double near, double far, IVector3 nearFarNormal) {
double rlr = 1f / (left - right);
double rbt = 1f / (bottom - top);
double rnf = 1f / (near - far);
double s = 2f / (near*nearFarNormal.z()... | java |
public static int distanceSq (int x1, int y1, int x2, int y2) {
x2 -= x1;
y2 -= y1;
return x2 * x2 + y2 * y2;
} | java |
public static int distance (int x1, int y1, int x2, int y2) {
return (int)Math.sqrt(distanceSq(x1, y1, x2, y2));
} | java |
public static int manhattanDistance (int x1, int y1, int x2, int y2)
{
return Math.abs(x2 - x1) + Math.abs(y2 - y1);
} | java |
public static double roundNearest (double v, double target) {
target = Math.abs(target);
if (v >= 0) {
return target * Math.floor((v + 0.5f * target) / target);
} else {
return target * Math.ceil((v - 0.5f * target) / target);
}
} | java |
public List<Probe> sendProbe(Probe probe) throws ProbeSenderException {
List<Probe> actualProbesToSend;
try {
actualProbesToSend = splitProbe(probe);
} catch (MalformedURLException | JAXBException | UnsupportedPayloadType e) {
throw new ProbeSenderException("Issue splitting the probe.", e);
... | java |
private List<Probe> splitProbe(Probe probe) throws ProbeSenderException, JAXBException, MalformedURLException, UnsupportedPayloadType {
List<Probe> actualProbeList = new ArrayList<Probe>();
int maxPayloadSize = this.probeTransport.maxPayloadSize();
LinkedList<ProbeIdEntry> combinedList = probe.getComb... | java |
public String getDescription() {
StringBuffer buf = new StringBuffer();
buf.append("ProbeSender for ");
buf.append(probeTransport.toString());
return buf.toString();
} | java |
public byte[] getMyZid() {
ZrtpCacheEntry ce = cache.get(LOCAL_ZID_KEY);
if (ce != null) {
return ce.getData();
} else {
byte[] zid = new byte[12];
platform.getCrypto().getRandomGenerator().getBytes(zid);
cache.put(LOCAL_ZID_KEY, zid, null);
platform.getLogger().log("[ZRTP] created new ZID=", zid);... | java |
public void selectEntry(byte[] remoteZID) {
platform.getLogger().log(
"ZRTPCache: selectEntry("
+ platform.getUtils().byteToHexString(remoteZID) + ")");
String zidString = new String(remoteZID);
if (currentZid != null && currentZid.equals(zidString)) {
return;
}
currentZid = null;
currentRs1 = ... | java |
public void updateEntry(long expiryTime, boolean trust,
byte[] retainedSecret, byte[] rs2, String number) {
if (platform.isVerboseLogging()) {
platform.getLogger().log(
"ZRTPCache: updateEntry("
+ expiryTime
+ ", "
+ trust
+ ", "
+ platform.getUtils().byteToHexString(
... | java |
public List<String> descriptionsForResponseIDs(List<String> _ids, boolean payload, boolean pretty) {
List<String> descriptions = new ArrayList<String>();
for (ServiceWrapper s : _cache) {
if (_ids.isEmpty() || _responseIds.contains(s.getResponseId())) {
StringBuffer buf = serviceDesciption(payloa... | java |
public List<String> descriptionsForProbeIDs(List<String> _ids, boolean payload, boolean pretty) {
List<String> descriptions = new ArrayList<String>();
for (ServiceWrapper s : _cache) {
if (_ids.isEmpty() || _probeIds.contains(s.getProbeId())) {
StringBuffer buf = serviceDesciption(payload, pretty... | java |
public String asJSON(boolean pretty) {
JSONSerializer ser = new JSONSerializer();
Gson gson = new Gson();
Gson prettyJson = new GsonBuilder().setPrettyPrinting().create();
JsonArray cacheArray = new JsonArray();
String cacheAsString;
for (ServiceWrapper s : _cache) {
String json = ser.m... | java |
@Override
public void sendProbe(Probe probe) throws TransportException {
LOGGER.info("Sending probe [" + probe.getProbeID() + "] on network inteface [" + networkInterface.getName() + "] at port [" + multicastAddress + ":" + multicastPort + "]");
LOGGER.debug("Probe requesting TTL of [" + probe.getHopLimit() ... | java |
public ResponseWrapper unmarshal(String payload) throws ResponseParseException {
Services xmlServices = parseResponsePayload(payload);
ResponseWrapper response = constructResponseWrapperFromResponse(xmlServices);
return response;
} | java |
public ServiceWrapper unmarshalService(String payload) throws ResponseParseException {
Service xmlService = parseServicePayload(payload);
ServiceWrapper service = constructServiceWrapperFromService(xmlService);
return service;
} | java |
public <T> T get(String key, T defaultValue) {
if (map.containsKey(key)) {
Object value = map.get(key);
return (T)(value instanceof byte[] ? unmarshall((byte[])value) : value);
}
return defaultValue;
} | java |
public void setRespondToPayloadType(String respondToPayloadType) throws UnsupportedPayloadType {
// Sanity check on the payload type values. Should be XML or JSON
// If the probe goes out with a bad value here, then the Responder may have
// problems
if (respondToPayloadType == null || respondToPayloadT... | java |
public LinkedList<ProbeIdEntry> getCombinedIdentifierList() {
LinkedList<ProbeIdEntry> combinedList = new LinkedList<ProbeIdEntry>();
for (String id : this.getProbeWrapper().getServiceContractIDs()) {
combinedList.add(new ProbeIdEntry("scid", id));
}
for (String id : this.getProbeWrapper().getSer... | java |
public static boolean checkClientId(boolean isLegacyAttributeList, String farEndClientID) {
if (ZRTP.CLIENT_ID_LEGACY.equals(farEndClientID))
return true;
if (ZRTP.CLIENT_ID_RFC.equals(farEndClientID))
return false;
boolean isPrintable = true;
for (int i = 0; i < farEndClientID.length(... | java |
public static float pointRectDistanceSq (IRectangle r, IPoint p) {
Point p2 = closestInteriorPoint(r, p);
return Points.distanceSq(p.x(), p.y(), p2.x, p2.y);
} | java |
public void cacheAll(ArrayList<ExpiringService> list) {
for (ExpiringService service : list) {
cache.put(service.getService().getId(), service);
}
} | java |
public String asJSON() {
Gson gson = new Gson();
clearExpired();
Cache jsonCache = new Cache();
for (ExpiringService svc : cache.values()) {
jsonCache.cache.add(svc.getService());
}
String json = gson.toJson(jsonCache);
return json;
} | java |
public void addRespondToURL(String label, String url) {
RespondToURL respondToURL = new RespondToURL();
respondToURL.label = label;
respondToURL.url = url;
respondToURLs.add(respondToURL);
} | java |
public String asString() {
StringBuffer buf = new StringBuffer();
buf.append(" PID: [ ").append(this.id).append(" ]");;
buf.append(" CID: [ ").append(this.clientId).append(" ]");;
buf.append(" DES: [ ").append(this.desVersion).append(" ]");;
buf.append(" SCIDS: [ " );
for (String scid : serviceC... | java |
public void setFrame (XY loc, IDimension size) {
setFrame(loc.x(), loc.y(), size.width(), size.height());
} | java |
public void setFrame (IRectangle r) {
setFrame(r.x(), r.y(), r.width(), r.height());
} | java |
public void setFrameFromDiagonal (XY p1, XY p2) {
setFrameFromDiagonal(p1.x(), p1.y(), p2.x(), p2.y());
} | java |
public void setFrameFromCenter (XY center, XY corner) {
setFrameFromCenter(center.x(), center.y(), corner.x(), corner.y());
} | java |
public static Point inverseTransform (double x, double y, double sx, double sy, double rotation,
double tx, double ty, Point result) {
x -= tx; y -= ty; // untranslate
double sinnega = Math.sin(-rotation), cosnega = Math.cos(-rotation);
double nx = (x * ... | java |
public void setServiceList(ArrayList<ServiceWrapper> services) {
writeLock.lock();
try {
LOGGER.info("Updating service list by " + Thread.currentThread().getName());
this.serviceList = services;
} finally {
writeLock.unlock();
}
} | java |
public void initializeWithPropertiesFilename(String filename) throws ProbeHandlerConfigException {
InputStream is;
// try to load the properties file off the classpath first
if (ConfigFileProbeHandlerPlugin.class.getResource(filename) != null) {
is = ConfigFileProbeHandlerPlugin.class.getResourceAsS... | java |
private void initializeTransports(ArrayList<TransportConfig> transportConfigs) {
for (TransportConfig config : transportConfigs) {
ClientProbeSenders transport = new ClientProbeSenders(config);
try {
transport.initialize(this);
_clientSenders.add(transport);
} catch (TransportConfi... | java |
private void initializeLocalhostNI() {
InetAddress localhost;
try {
localhost = InetAddress.getLocalHost();
NetworkInterface ni = NetworkInterface.getByInetAddress(localhost);
if (ni != null)
getNIList().add(ni.getName());
} catch (UnknownHostException | SocketException e) {
... | java |
public List<String> getAvailableNetworkInterfaces(boolean requiresMulticast) throws SocketException {
Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
List<String> multicastNIs = new ArrayList<String>();
// Console.info("Available Multicast-enabled Network Interfaces");
wh... | java |
public ClientProbeSenders getClientTransportNamed(String transportName) {
ClientProbeSenders found = null;
for (ClientProbeSenders t : _clientSenders) {
if (t.getName().equalsIgnoreCase(transportName)) {
found = t;
break;
}
}
return found;
} | java |
public static <T extends Case3<A, B, C>, A, B, C> DecomposableMatchBuilder0<T> case3(
Class<T> clazz, MatchesExact<A> a, MatchesExact<B> b, MatchesExact<C> c) {
List<Matcher<Object>> matchers =
Lists.of(ArgumentMatchers.eq(a.t), ArgumentMatchers.eq(b.t), ArgumentMatchers.eq(c.t));
return new Decom... | java |
public CommandResult execute(T context) {
try {
return innerExecute(context);
} catch (Exception e) {
Console.error(e.getMessage());
return CommandResult.ERROR;
}
} | java |
public long factMatching(long n) {
return match(n)
.when(caseLong(0)).get(() -> 1L)
.when(caseLong(any())).get(i -> i * factMatching(i - 1))
.getMatch();
} | java |
public static IShape createTransformedShape (Transform t, IShape src) {
if (src == null) {
return null;
}
if (src instanceof Path) {
return ((Path)src).createTransformedShape(t);
}
PathIterator path = src.pathIterator(t);
Path dst = new Path(path.w... | java |
private static void sort (double[] coords1, int length1,
double[] coords2, int length2, int[] array) {
int temp;
int length = length1 + length2;
double x1, y1, x2, y2;
for (int i = 1; i < length; i++) {
if (array[i - 1] < length1) {
... | java |
public void setFrameFromDiagonal (float x1, float y1, float x2, float y2) {
float rx, ry, rw, rh;
if (x1 < x2) {
rx = x1;
rw = x2 - x1;
} else {
rx = x2;
rw = x1 - x2;
}
if (y1 < y2) {
ry = y1;
rh = y2 - y1;
... | java |
public void setFrameFromCenter (float centerX, float centerY,
float cornerX, float cornerY) {
float width = Math.abs(cornerX - centerX);
float height = Math.abs(cornerY - centerY);
setFrame(centerX - width, centerY - height, width * 2, height * 2);
} | java |
@POST
@Path("/probeResponse")
@Consumes("application/json")
public String handleJSONProbeResponse(String probeResponseJSON) {
JSONSerializer serializer = new JSONSerializer();
ResponseWrapper response;
try {
response = serializer.unmarshal(probeResponseJSON);
} catch (ResponseParseExceptio... | java |
public Circle set (ICircle c) {
return set(c.x(), c.y(), c.radius());
} | java |
public Circle set (double x, double y, double radius) {
this.x = x;
this.y = y;
this.radius = radius;
return this;
} | java |
public Matrix4 setToRotation (float angle, float x, float y, float z) {
float c = FloatMath.cos(angle), s = FloatMath.sin(angle), omc = 1f - c;
float xs = x*s, ys = y*s, zs = z*s, xy = x*y, xz = x*z, yz = y*z;
return set(x*x*omc + c, xy*omc - zs, xz*omc + ys, 0f,
xy*omc + zs, ... | java |
public Matrix4 setToReflection (float x, float y, float z, float w) {
float x2 = -2f*x, y2 = -2f*y, z2 = -2f*z;
float xy2 = x2*y, xz2 = x2*z, yz2 = y2*z;
float x2y2z2 = x*x + y*y + z*z;
return set(1f + x2*x, xy2, xz2, x2*w*x2y2z2,
xy2, 1f + y2*y, yz2, y2*w*x2y2z2,
... | java |
public Matrix4 set (float[] values) {
return set(values[0], values[1], values[2], values[3],
values[4], values[5], values[6], values[7],
values[8], values[9], values[10], values[11],
values[12], values[13], values[14], values[15]);
} | java |
public void launch(Object arg) {
ReconnectableMap.INSTANCE.dismiss(key);
out.put("restore", true);
out.put("arg", arg);
launches.onNext(arg);
} | java |
public static <E> List<E> of(E e1, E e2, E e3, E e4) {
List<E> list = new ArrayList<>();
list.add(e1);
list.add(e2);
list.add(e3);
list.add(e4);
return list;
} | java |
public void run() {
LOGGER.debug("begin scan for config file changes ...");
try {
Date lastModified = new Date(_xmlConfigFile.lastModified());
if (_lastTimeRead == null || lastModified.after(_lastTimeRead)) {
LOGGER.info("loading config file changes ...");
this.loadServiceConfigFile... | java |
private void loadServiceConfigFile() throws ConfigurationException {
Properties properties = _plugin.getConfiguration();
Configuration config = ConfigurationConverter.getConfiguration(properties);
String xmlConfigFilename = config.getString("xmlConfigFilename");
_config = new ServiceListConfiguration(xmlCon... | java |
public void initialize(ArgoClientContext context) throws TransportConfigException {
transportProps = processPropertiesFile(config.getPropertiesFilename());
createProbeSenders(context);
} | java |
public String getDescription() {
StringBuffer buf = new StringBuffer();
String transportName = config.getName();
for (ProbeSender sender : senders) {
buf.append(transportName).append(" -- ").append(isEnabled() ? "Enabled" : "Disabled")
.append(" -- ").append(sender.getDescription());
}
... | java |
public String showConfiguration() {
StringBuffer buf = new StringBuffer();
buf.append("\n Client Transport Configuration\n");
buf.append(" Name ...................... ").append(config.getName()).append("\n");
buf.append(" Is Enabled................. ").append(isEnabled()).append("\n");
buf.... | java |
public void close() {
for (ProbeSender sender : getSenders()) {
try {
sender.close();
} catch (TransportException e) {
LOGGER.warn( "Issue closing the ProbeSender [" + sender.getDescription() + "]", e);
}
}
} | java |
private void createProbeSenders(ArgoClientContext context) throws TransportConfigException {
senders = new ArrayList<ProbeSender>();
if (config.usesNetworkInterface()) {
try {
for (String niName : context.getAvailableNetworkInterfaces(config.requiresMulticast())) {
try {
... | java |
protected List<TypeVariableName> getTypeVariables(TypeName t) {
return match(t)
.when(typeOf(TypeVariableName.class)).get(
v -> {
if (v.bounds.isEmpty()) {
return ImmutableList.of(v);
} else {
return Stream.concat(
S... | java |
protected List<TypeNameWithArity> createTypeArityList(
TypeName t, String extractVariableName, int maxArity) {
TypeName u = match(t)
.when(typeOf(TypeVariableName.class))
.get(x -> (TypeName) TypeVariableName.get("E" + x.name, x))
.orElse(x -> x)
.getMatch();
List<TypeName... | java |
protected TypeName[] createTypeVariables(
TypeName extractedType, String extractVariableName, int extractArity) {
List<TypeName> typeVariables = new ArrayList<>();
typeVariables.add(extractedType);
if (extractArity > 0) {
typeVariables.addAll(
IntStream.rangeClosed(1, extractArity)
... | java |
protected static Object[] getMatcherStatementArgs(int matchedCount) {
TypeName matcher = ParameterizedTypeName.get(ClassName.get(Matcher.class), TypeName.OBJECT);
TypeName listOfMatchers = ParameterizedTypeName.get(ClassName.get(List.class), matcher);
TypeName lists = TypeName.get(Lists.class);
TypeName... | java |
protected MatchType getMatchType(TypeName m) {
return match(m)
.when(typeOf(ParameterizedTypeName.class)).get(
t -> {
if (isDecomposableBuilder(t.rawType)) {
return MatchType.DECOMPOSE;
} else if (t.rawType.equals(MATCH_ANY)) {
return M... | java |
protected List<TypeName> getExtractedTypes(TypeName permutationType, TypeName paramType) {
return match(permutationType)
.when(typeOf(ParameterizedTypeName.class)).get(
t -> {
if (isDecomposableBuilder(t.rawType)) {
return t.typeArguments.subList(1, t.typeArguments.... | java |
protected List<TypeName> getReturnStatementArgs(MatchType matchType, TypeName paramType) {
List<TypeName> extractA;
if (matchType == MatchType.DECOMPOSE) {
TypeName u = match(paramType)
.when(typeOf(TypeVariableName.class)).get(
x -> (TypeName) TypeVariableName.get("E" + x.name, x)... | java |
public static ProbeSender createMulticastProbeSender() throws ProbeSenderException, TransportConfigException {
Transport mcastTransport = new MulticastTransport("");
ProbeSender gen = new ProbeSender(mcastTransport);
return gen;
} | java |
public static ProbeSender createMulticastProbeSender(String niName) throws TransportConfigException {
Transport mcastTransport = new MulticastTransport(niName);
ProbeSender gen = new ProbeSender(mcastTransport);
return gen;
} | java |
public static ProbeSender createSNSProbeSender(String ak, String sk) throws ProbeSenderException {
Transport snsTransport = new AmazonSNSTransport(ak, sk);
ProbeSender gen = new ProbeSender(snsTransport);
return gen;
} | java |
private void initializeHTTPClient() {
if (_config.isHTTPSConfigured()) {
try {
KeyStore trustKeystore = getClientTruststore();
SSLContext sslContext = SSLContexts.custom()
.loadTrustMaterial(trustKeystore, new TrustSelfSignedStrategy())
.build();
SSLConnection... | java |
private KeyStore getClientTruststore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
KeyStore ks = null;
if (_config.getTruststoreType() != null && !_config.getTruststoreType().isEmpty()) {
try {
ks = KeyStore.getInstance(_config.getTruststoreType())... | java |
public void stopResponder() {
LOGGER.info("Force shutdown of Responder [" + _runtimeId + "]");
_shutdownHook.start();
Runtime.getRuntime().removeShutdownHook(_shutdownHook);
} | java |
public void shutdown() {
LOGGER.info("Responder shutting down: [" + _runtimeId + "]");
for (Transport t : _transports) {
try {
t.shutdown();
} catch (TransportException e) {
LOGGER.warn( "Error shutting down transport: [" + t.transportName() + "]", e);
}
}
} | java |
public void run() {
// I hope that this hits you over the head with its simplicity.
// That's the idea. The instances of the transports are supposed to be self
// contained.
Thread transportThread;
for (Transport t : _transports) {
transportThread = new Thread(t);
transportThread.setN... | java |
public synchronized float probesPerSecond() {
Instant now = new Instant();
Instant event = null;
int events = 0;
boolean done = false;
long timeWindow = 0;
long oldestTime = 0;
do {
event = messages.poll();
if (event != null) {
events++;
if (events == 1)
... | java |
public static void main(String[] args) throws ResponderConfigException {
Responder responder = initialize(args);
if (responder != null) {
responder.run();
}
} | java |
public static Responder initialize(String[] args) throws ResponderConfigException {
readVersionProperties();
LOGGER.info("Starting Argo Responder daemon process. Version " + ARGO_VERSION);
ResponderConfiguration config = parseCommandLine(args);
if (config == null) {
LOGGER.error( "Invalid Respo... | java |
private void loadProperties(String propFileName) {
if (propFileName != null) {
loadProperties(getClass().getResourceAsStream(propFileName), propFileName);
}
} | java |
private void loadProperties(InputStream stream, String path) {
if (stream == null) {
return;
}
try {
Properties props = new Properties();
props.load(stream);
Iterator<Object> keyIt = props.keySet().iterator();
while (keyIt.hasNext()) {
String key = keyIt.next().toString();
... | java |
public Object put(String key, Object o) {
return _properties.put(key, o);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.