code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static CommandLine parse(Options options, String... args) throws Exception {
return CommandLineParser.parse(options, args);
} | java |
public static ResourceLoader getModuleResourceLoader(final String rootPath, final String loaderPath, final String loaderName) {
if (Holder.JAR_FILE != null) {
return new JarFileResourceLoader(loaderName, Holder.JAR_FILE, Holder.FILE_SYSTEM.getPath(rootPath, loaderPath).toString());
}
... | java |
@Override
public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) {
List<String> authHeaders = exchange.getRequestHeaders().get(AUTHORIZATION);
if (authHeaders != null) {
String bearerToken = null;
for (String current :... | java |
protected RoleGroup extract(Subject subject) {
Optional<Principal> match = subject.getPrincipals()
.stream()
.filter(g -> g.getName().equals(SecurityConstants.ROLES_IDENTIFIER))
.findFirst();
Group rolesGroup = (Group) match.get();
RoleGroup roles ... | java |
public ConfigViewImpl withProperties(Properties properties) {
if (properties != null) {
this.properties = properties;
this.strategy.withProperties(properties);
}
return this;
} | java |
private Set<String> getPackagesForScanning(WARArchive deployment) {
final Set<String> packages = new TreeSet<>();
if (indexView != null) {
DotName dotName = DotName.createSimple(Api.class.getName());
Collection<AnnotationInstance> instances = indexView.getAnnotations(dotName);
... | java |
public void stop() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
this.serviceContainer.addTerminateListener(info -> latch.countDown());
this.serviceContainer.shutdown();
latch.await();
executor.submit(new Runnable() {
@Override
... | java |
public void beforeShutdown(@Observes final BeforeShutdown bs) {
monitor.unregisterHealthReporter();
monitor.unregisterContextClassLoader();
reporter = null;
reporterInstance.preDestroy().dispose();
reporterInstance = null;
} | java |
void setup(final Map<String, Object> properties) {
final List<SetupAction> successfulActions = new ArrayList<SetupAction>();
for (final SetupAction action : setupActions) {
try {
action.setup(properties);
successfulActions.add(action);
} catch (fin... | java |
private void resolveDependenciesInParallel(List<DependencyNode> nodes) {
List<ArtifactRequest> artifactRequests = nodes.stream()
.map(node -> new ArtifactRequest(node.getArtifact(), this.remoteRepositories, null))
.collect(Collectors.toList());
try {
this.res... | java |
public Swarm outboundSocketBinding(String socketBindingGroup, OutboundSocketBinding binding) {
this.outboundSocketBindings.add(new OutboundSocketBindingRequest(socketBindingGroup, binding));
return this;
} | java |
public Swarm socketBinding(String socketBindingGroup, SocketBinding binding) {
this.socketBindings.add(new SocketBindingRequest(socketBindingGroup, binding));
return this;
} | java |
public Swarm start() throws Exception {
INSTANCE = this;
try (AutoCloseable handle = Performance.time("Thorntail.start()")) {
Module module = Module.getBootModuleLoader().loadModule(CONTAINER_MODULE_NAME);
Class<?> bootstrapClass = module.getClassLoader().loadClass("org.wildfly... | java |
public Swarm stop() throws Exception {
if (this.server == null) {
throw SwarmMessages.MESSAGES.containerNotStarted("stop()");
}
this.server.stop();
this.server = null;
Module module = Module.getBootModuleLoader().loadModule(CONTAINER_MODULE_NAME);
Class<?> ... | java |
public Swarm deploy() throws IllegalStateException, DeploymentException {
if (this.server == null) {
throw SwarmMessages.MESSAGES.containerNotStarted("deploy()");
}
if (ApplicationEnvironment.get().isHollow()) {
this.server.deployer().deploy(
getComma... | java |
public Archive<?> createDefaultDeployment() throws Exception {
if (this.server == null) {
throw SwarmMessages.MESSAGES.containerNotStarted("createDefaultDeployment()");
}
return this.server.deployer().createDefaultDeployment();
} | java |
public static JavaArchive artifact(String gav, String asName) throws Exception {
return artifactLookup().artifact(gav, asName);
} | java |
private void installModuleMBeanServer() {
try {
Method method = ModuleLoader.class.getDeclaredMethod("installMBeanServer");
method.setAccessible(true);
method.invoke(null);
} catch (Exception e) {
SwarmMessages.MESSAGES.moduleMBeanServerNotInstalled(e);
... | java |
File downloadFromRemoteRepository(ArtifactCoordinates artifactCoordinates, String packaging, Path artifactDirectory) {
String artifactRelativeHttpPath = toGradleArtifactPath(artifactCoordinates);
String artifactRelativeMetadataHttpPath = artifactCoordinates.relativeMetadataPath('/');
for (String... | java |
File doDownload(String remoteRepos, String artifactAbsoluteHttpPath, String artifactRelativeHttpPath, ArtifactCoordinates artifactCoordinates, String packaging, File targetArtifactPomDirectory, File targetArtifactDirectory) {
//Download POM
File targetArtifactPomFile = new File(targetArtifactPomDirector... | java |
String toGradleArtifactFileName(ArtifactCoordinates artifactCoordinates, String packaging) {
StringBuilder sbFileFilter = new StringBuilder();
sbFileFilter
.append(artifactCoordinates.getArtifactId())
.append("-")
.append(artifactCoordinates.getVersion());... | java |
String toGradleArtifactPath(ArtifactCoordinates artifactCoordinates) {
// e.g.: org/jboss/ws/cxf/jbossws-cxf-resources/5.1.5.Final/jbossws-cxf-resources-5.1.5.Final
String pathWithMissingClassifier = artifactCoordinates.relativeArtifactPath('/');
StringBuilder sb = new StringBuilder(pathWithMiss... | java |
String computeGradleUUID(String content) {
try {
MessageDigest md = MessageDigest.getInstance(MD5_ALGORITHM);
md.reset();
byte[] bytes = content.trim().toLowerCase(Locale.US).getBytes("UTF-8");
md.update(bytes, 0, bytes.length);
return byteArrayToHexSt... | java |
private DeclaredDependencies getDependenciesViaIdeaModel(ProjectConnection connection) {
DeclaredDependencies declaredDependencies = new DeclaredDependencies();
// 1. Get the IdeaProject model from the Gradle connection.
IdeaProject prj = connection.getModel(IdeaProject.class);
prj.getM... | java |
private static ArtifactSpec toArtifactSpec(DependencyDescriptor desc, String scope) {
return new ArtifactSpec(scope, desc.getGroup(), desc.getName(), desc.getVersion(), desc.getType(),
desc.getClassifier(), desc.getFile());
} | java |
void activate() {
nodes().flatMap(e -> e.allKeysRecursively())
.distinct()
.forEach(key -> {
activate(key);
});
} | java |
public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final String name) throws IOException {
return createMavenArtifactLoader(mavenResolver, ArtifactCoordinates.fromString(name), name);
} | java |
public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final ArtifactCoordinates coordinates, final String rootName) throws IOException {
File fp = mavenResolver.resolveJarArtifact(coordinates);
if (fp == null) return null;
JarFile jarFile = JDKSpecific.getJarF... | java |
protected JWTCallerPrincipal validate(JWTCredential jwtCredential) throws ParseException {
JWTCallerPrincipalFactory factory = JWTCallerPrincipalFactory.instance();
JWTCallerPrincipal callerPrincipal = factory.parse(jwtCredential.getBearerToken(), jwtCredential.getAuthContextInfo());
return call... | java |
@SuppressWarnings("deprecation")
private HttpHandler secureHandler(final HttpHandler toWrap, SecurityRealm securityRealm) {
HttpHandler handler = toWrap;
handler = new AuthenticationCallHandler(handler);
handler = new AuthenticationConstraintHandler(handler);
RealmIdentityManager i... | java |
private boolean isWar(String path) {
String currentDir = Paths.get(".").toAbsolutePath().normalize().toString();
String classesDirPath = Paths.get(path).toAbsolutePath().normalize().toString();
return classesDirPath.startsWith(currentDir);
} | java |
public static String determinePluginVersion() {
if (pluginVersion == null) {
final String fileName = "META-INF/gradle-plugins/thorntail.properties";
ClassLoader loader = Thread.currentThread().getContextClassLoader();
String version;
try (InputStream stream = load... | java |
public static boolean isProject(Project project, DependencyDescriptor descriptor) {
final String specGAV = String.format("%s:%s:%s", descriptor.getGroup(), descriptor.getName(), descriptor.getVersion());
return getAllProjects(project).containsKey(specGAV) || getIncludedProjectIdentifiers(project).contai... | java |
public static Set<ArtifactSpec> resolveArtifacts(Project project, Collection<ArtifactSpec> specs, boolean transitive,
boolean excludeDefaults) {
if (project == null) {
throw new IllegalArgumentException("Gradle project reference cannot be null.");... | java |
public static Map<DependencyDescriptor, Set<DependencyDescriptor>>
determineProjectDependencies(Project project, String configuration, boolean resolveChildrenTransitively) {
if (project == null) {
throw new IllegalArgumentException("Gradle project reference cannot be null.");
}
p... | java |
private static void printDependencyMap(Map<DependencyDescriptor, Set<DependencyDescriptor>> map, Project project) {
final String NEW_LINE = "\n";
if (project.getLogger().isEnabled(LogLevel.INFO)) {
StringBuilder builder = new StringBuilder(100);
builder.append("Resolved dependenc... | java |
private static Map<String, Project> getAllProjects(final Project project) {
return getCachedReference(project, "thorntail_project_gav_collection", () -> {
Map<String, Project> gavMap = new HashMap<>();
project.getRootProject().getAllprojects().forEach(p -> {
gavMap.put(p.... | java |
public void ifPresent(Consumer<? super T> consumer) {
T value = get(false);
if (value != null) {
consumer.accept(value);
}
} | java |
public static FileSystemLayout create() {
String userDir = System.getProperty(USER_DIR);
if (null == userDir) {
throw SwarmMessages.MESSAGES.systemPropertyNotFound(USER_DIR);
}
return create(userDir);
} | java |
public static FileSystemLayout create(String root) {
// THORN-2178: Check if a System property has been set to a specific implementation class.
String implClassName = System.getProperty(CUSTOM_LAYOUT_CLASS);
if (implClassName != null) {
implClassName = implClassName.trim();
... | java |
@Override
public void process() throws Exception {
// if the deployment is Implicit, we don't want to process it
if (deploymentContext != null && deploymentContext.isImplicit()) {
return;
}
try {
// First register OpenApiServletContextListener which triggers t... | java |
public static URL toURL(String value) throws MalformedURLException {
try {
URL url = new URL(value);
return url;
} catch (MalformedURLException e) {
try {
return new File(value).toURI().toURL();
} catch (MalformedURLException e2) {
... | java |
public static void explodeJar(JarFile jarFile, String destDir) throws IOException {
Enumeration<java.util.jar.JarEntry> enu = jarFile.entries();
while (enu.hasMoreElements()) {
JarEntry je = enu.nextElement();
File fl = new File(destDir, je.getName());
if (!fl.exists... | java |
public void scan(PathSource fileSource, Collection<FractionDetector<PathSource>> detectors, Consumer<File> handleFileAsZip) throws IOException {
detectors.stream()
.filter(d -> FileDetector.class.isAssignableFrom(d.getClass()))
.forEach(d -> d.detect(fileSource));
} | java |
void observesAfterBeanDiscovery(@Observes final AfterBeanDiscovery event, final BeanManager beanManager) {
log.debugf("observesAfterBeanDiscovery, %s", claims);
installClaimValueProducerMethodsViaSyntheticBeans(event, beanManager);
} | java |
public Collection<ArtifactSpec> getDirectDependencies(boolean includeUnsolved, boolean includePresolved) {
Set<ArtifactSpec> deps = new LinkedHashSet<>();
if (includeUnsolved) {
deps.addAll(getDirectDeps());
}
if (includePresolved) {
deps.addAll(presolvedDependenc... | java |
public Set<ArtifactSpec> getTransientDependencies() {
if (null == allTransient) {
allTransient = getTransientDependencies(true, true);
}
return allTransient;
} | java |
public Set<ArtifactSpec> getTransientDependencies(boolean includeUnsolved, boolean includePresolved) {
Set<ArtifactSpec> deps = new HashSet<>();
List<DependencyTree<ArtifactSpec>> sources = new ArrayList<>();
if (includeUnsolved) {
sources.add(this);
}
if (includePres... | java |
public Collection<ArtifactSpec> getTransientDependencies(ArtifactSpec artifact) {
Set<ArtifactSpec> deps = new HashSet<>();
if (this.isDirectDep(artifact)) {
deps.addAll(getTransientDeps(artifact));
}
if (presolvedDependencies.isDirectDep(artifact)) {
deps.addAll(... | java |
public EnhancedServer remoteConnection(String name) {
return remoteConnection(name, (config) -> {
});
}
/**
* Setup a named remote connection to a remote message broker.
*
* @param name The name of the connection.
* @param config The configuration.
* @return This serv... | java |
public JsonValue generalJsonValueProducer(InjectionPoint ip) {
String name = getName(ip);
Object value = getValue(name, false);
JsonValue jsonValue = wrapValue(value);
return jsonValue;
} | java |
private void cleanup() throws IOException {
JarFileManager.INSTANCE.close();
TempFileManager.INSTANCE.close();
MavenResolvers.close();
} | java |
private void closeRemoteResources() {
if (reader != null) {
try {
reader.close();
} catch (final IOException ignore) {
}
reader = null;
}
if (writer != null) {
writer.close();
writer = null;
}
... | java |
public static ArtifactCoordinates fromString(String string) {
final Matcher matcher = VALID_PATTERN.matcher(string);
if (matcher.matches()) {
if (matcher.group(4) != null) {
return new ArtifactCoordinates(matcher.group(1), matcher.group(2), matcher.group(3), matcher.group(4))... | java |
public String relativeArtifactPath(char separator) {
String artifactId1 = getArtifactId();
String version1 = getVersion();
StringBuilder builder = new StringBuilder(getGroupId().replace('.', separator));
builder.append(separator).append(artifactId1).append(separator);
String path... | java |
public Module withImportIncludePath(String path) {
checkList(this.imports, INCLUDE);
this.imports.get(INCLUDE).add(path);
return this;
} | java |
public Module withImportExcludePath(String path) {
checkList(this.imports, EXCLUDE);
this.imports.get(EXCLUDE).add(path);
return this;
} | java |
public Module withExportIncludePath(String path) {
checkList(this.exports, INCLUDE);
this.exports.get(INCLUDE).add(path);
return this;
} | java |
public Module withExportExcludePath(String path) {
checkList(this.exports, EXCLUDE);
this.exports.get(EXCLUDE).add(path);
return this;
} | java |
public String getRelativePath() {
if (basePath == null) {
return source.toString();
}
return basePath.relativize(source).toString();
} | java |
public Section mbean(String name, MBeanRule.Consumer config) {
MBeanRule rule = new MBeanRule(name);
config.accept(rule);
this.rules.add(rule);
return this;
} | java |
public URLConnection openConnection(URL url) throws IOException {
Proxy proxy = getProxyFor(url);
URLConnection conn = null;
if (proxy != null) {
conn = url.openConnection(proxy.getProxy());
proxy.authenticate(conn);
} else {
conn = url.openConnection... | java |
public static JoseFactory instance() {
if (instance == null) {
synchronized (JoseFactory.class) {
if (instance != null) {
return instance;
}
ClassLoader cl = AccessController.doPrivileged((PrivilegedAction<ClassLoader>) () -> Threa... | java |
private static JoseFactory loadSpi(ClassLoader cl) {
if (cl == null) {
return null;
}
// start from the root CL and go back down to the TCCL
JoseFactory instance = loadSpi(cl.getParent());
if (instance == null) {
ServiceLoader<JoseFactory> sl = ServiceLo... | java |
public static void addService(ServiceTarget serviceTarget, SwarmContentRepository repository) {
serviceTarget.addService(SERVICE_NAME, repository)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
} | java |
public void proxyService(String serviceName, String contextPath) {
if (proxiedServiceMappings().containsValue(contextPath)) {
throw new IllegalArgumentException("Cannot proxy multiple services under the same context path");
}
proxiedServiceMappings.put(serviceName, contextPath);
... | java |
private File buildWar(List<ArtifactOrFile> classPathEntries) {
try {
List<String> classesUrls = classPathEntries.stream()
.map(ArtifactOrFile::file)
.filter(this::isDirectory)
.filter(url -> url.contains("classes"))
.col... | java |
private static void resolveDependencies(Collection<ArtifactSpec> collection, ShrinkwrapArtifactResolvingHelper helper) {
// Identify the artifact specs that need resolution.
// Ideally, there should be none at this point.
collection.forEach(spec -> {
if (spec.file == null) {
... | java |
public SocketBinding socketBinding(String name) {
return this.socketBindings.stream().filter(e -> e.name().equals(name)).findFirst().orElse(null);
} | java |
@Override
public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) {
deploymentInfo.addAuthenticationMechanism("MP-JWT", new JWTAuthMechanismFactory());
deploymentInfo.addInnerHandlerChainWrapper(MpJwtPrincipalHandler::new);
} | java |
@Override
public long alloc(int chunks, long prevPos, int prevChunks) {
long ret = s.allocReturnCode(chunks);
if (prevPos >= 0)
s.free(prevPos, prevChunks);
if (ret >= 0)
return ret;
while (true) {
s.nextTier();
ret = s.allocReturnCode(... | java |
private static String getVersionFromPom() {
final String absolutePath = new File(BuildVersion.class.getResource(BuildVersion.class
.getSimpleName() + ".class").getPath())
.getParentFile().getParentFile().getParentFile().getParentFile().getParentFile()
.getParentF... | java |
public void setupStyleable(Context context, AttributeSet attrs) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundCornerProgress);
radius = (int) typedArray.getDimension(R.styleable.RoundCornerProgress_rcRadius, dp2px(DEFAULT_PROGRESS_RADIUS));
padding = (int) typ... | java |
@Override
protected void onSizeChanged(int newWidth, int newHeight, int oldWidth, int oldHeight) {
super.onSizeChanged(newWidth, newHeight, oldWidth, oldHeight);
if(!isInEditMode()) {
totalWidth = newWidth;
drawAll();
postDelayed(new Runnable() {
@... | java |
@SuppressWarnings("deprecation")
private void drawBackgroundProgress() {
GradientDrawable backgroundDrawable = createGradientDrawable(colorBackground);
int newRadius = radius - (padding / 2);
backgroundDrawable.setCornerRadii(new float[]{newRadius, newRadius, newRadius, newRadius, newRadius,... | java |
protected GradientDrawable createGradientDrawable(int color) {
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setShape(GradientDrawable.RECTANGLE);
gradientDrawable.setColor(color);
return gradientDrawable;
} | java |
private void setupReverse(LinearLayout layoutProgress) {
RelativeLayout.LayoutParams progressParams = (RelativeLayout.LayoutParams) layoutProgress.getLayoutParams();
removeLayoutParamsRule(progressParams);
if (isReverse) {
progressParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
... | java |
private void removeLayoutParamsRule(RelativeLayout.LayoutParams layoutParams) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_END);
layoutParam... | java |
public int sendTCP (Object object) {
if (object == null) throw new IllegalArgumentException("object cannot be null.");
try {
int length = tcp.send(this, object);
if (length == 0) {
if (TRACE) trace("kryonet", this + " TCP had nothing to send.");
} else if (DEBUG) {
String objectString = object == n... | java |
public int sendUDP (Object object) {
if (object == null) throw new IllegalArgumentException("object cannot be null.");
SocketAddress address = udpRemoteAddress;
if (address == null && udp != null) address = udp.connectedAddress;
if (address == null && isConnected) throw new IllegalStateException("Connection is ... | java |
public InetSocketAddress getRemoteAddressTCP () {
SocketChannel socketChannel = tcp.socketChannel;
if (socketChannel != null) {
Socket socket = tcp.socketChannel.socket();
if (socket != null) {
return (InetSocketAddress)socket.getRemoteSocketAddress();
}
}
return null;
} | java |
public InetSocketAddress getRemoteAddressUDP () {
InetSocketAddress connectedAddress = udp.connectedAddress;
if (connectedAddress != null) return connectedAddress;
return udpRemoteAddress;
} | java |
public void close () {
Connection[] connections = this.connections;
for (int i = 0; i < connections.length; i++)
connections[i].removeListener(invokeListener);
synchronized (instancesLock) {
ArrayList<ObjectSpace> temp = new ArrayList(Arrays.asList(instances));
temp.remove(this);
instances = temp.toA... | java |
public void addConnection (Connection connection) {
if (connection == null) throw new IllegalArgumentException("connection cannot be null.");
synchronized (connectionsLock) {
Connection[] newConnections = new Connection[connections.length + 1];
newConnections[0] = connection;
System.arraycopy(connections,... | java |
public void removeConnection (Connection connection) {
if (connection == null) throw new IllegalArgumentException("connection cannot be null.");
connection.removeListener(invokeListener);
synchronized (connectionsLock) {
ArrayList<Connection> temp = new ArrayList(Arrays.asList(connections));
temp.remove(c... | java |
static Object getRegisteredObject (Connection connection, int objectID) {
ObjectSpace[] instances = ObjectSpace.instances;
for (int i = 0, n = instances.length; i < n; i++) {
ObjectSpace objectSpace = instances[i];
// Check if the connection is in this ObjectSpace.
Connection[] connections = objectSpace.co... | java |
static int getRegisteredID (Connection connection, Object object) {
ObjectSpace[] instances = ObjectSpace.instances;
for (int i = 0, n = instances.length; i < n; i++) {
ObjectSpace objectSpace = instances[i];
// Check if the connection is in this ObjectSpace.
Connection[] connections = objectSpace.connecti... | java |
static public void registerClasses (final Kryo kryo) {
kryo.register(Object[].class);
kryo.register(InvokeMethod.class);
FieldSerializer<InvokeMethodResult> resultSerializer = new FieldSerializer<InvokeMethodResult>(kryo,
InvokeMethodResult.class) {
public void write (Kryo kryo, Output output, InvokeMethod... | java |
public void ensureCapacity (int additionalCapacity) {
int sizeNeeded = size + additionalCapacity;
if (sizeNeeded >= threshold) resize(ObjectMap.nextPowerOfTwo((int)(sizeNeeded / loadFactor)));
} | java |
public InetAddress discoverHost (int udpPort, int timeoutMillis) {
DatagramSocket socket = null;
try {
socket = new DatagramSocket();
broadcast(udpPort, socket);
socket.setSoTimeout(timeoutMillis);
DatagramPacket packet = discoveryHandler.onRequestNewDatagramPacket();
try {
socket.receive(packet)... | java |
public List<InetAddress> discoverHosts (int udpPort, int timeoutMillis) {
List<InetAddress> hosts = new ArrayList<InetAddress>();
DatagramSocket socket = null;
try {
socket = new DatagramSocket();
broadcast(udpPort, socket);
socket.setSoTimeout(timeoutMillis);
while (true) {
DatagramPacket packet ... | java |
public void sendToAllTCP (Object object) {
Connection[] connections = this.connections;
for (int i = 0, n = connections.length; i < n; i++) {
Connection connection = connections[i];
connection.sendTCP(object);
}
} | java |
@Override
public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception {
checkFile(query);
List<String> typeNames = getTypeNames();
for (Result result : results) {
String[] keyString = KeyUtils.getKeyString(server, query, result, typeNames, null).split("\\.");
if (... | java |
protected String nagiosCheckValue(String value, String composeRange) {
List<String> simpleRange = Arrays.asList(composeRange.split(","));
double doubleValue = Double.parseDouble(value);
if (composeRange.isEmpty()) {
return "0";
}
if (simpleRange.size() == 1) {
if (composeRange.endsWith(",")) {
if ... | java |
@Override
public void prepareSender() throws LifecycleException {
if (host == null || port == null) {
throw new LifecycleException("Host and port for " + this.getClass().getSimpleName() + " output can't be null");
}
try {
this.dgSocket = new DatagramSocket();
this.address = new InetSocketAddress(host,... | java |
@Override
protected void sendOutput(String metricLine) throws IOException {
DatagramPacket packet;
byte[] data;
data = metricLine.getBytes("UTF-8");
packet = new DatagramPacket(data, 0, data.length, this.address);
this.dgSocket.send(packet);
} | java |
public static boolean isNumeric(Object value) {
if (value == null) return false;
if (value instanceof Number) return true;
if (value instanceof String) {
String stringValue = (String) value;
if (isNullOrEmpty(stringValue)) return true;
return isNumber(stringValue);
}
return false;
} | java |
@Override
public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception {
this.startOutput();
for (String formattedResult : messageFormatter.formatResults(results, server)) {
log.debug("Sending result: {}", formattedResult);
this.sendOutput(formattedResult);
}
th... | java |
public static String getKeyString(Server server, Query query, Result result, List<String> typeNames, String rootPrefix) {
StringBuilder sb = new StringBuilder();
addRootPrefix(rootPrefix, sb);
addAlias(server, sb);
addSeparator(sb);
addMBeanIdentifier(query, result, sb);
addSeparator(sb);
addTypeName(quer... | java |
public static String getKeyString(Query query, Result result, List<String> typeNames) {
StringBuilder sb = new StringBuilder();
addMBeanIdentifier(query, result, sb);
addSeparator(sb);
addTypeName(query, result, typeNames, sb);
addKeyString(query, result, sb);
return sb.toString();
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.