本文整理了Java中hudson.remoting.Channel.getName()
方法的一些代码示例,展示了Channel.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.getName()
方法的具体详情如下:
包路径:hudson.remoting.Channel
类名称:Channel
方法名:getName
暂无
代码示例来源:origin: jenkinsci/jenkins
@Override
public void onClosed(Channel channel, IOException cause) {
LOGGER.fine("Terminating ping thread for " + channel.getName());
isInClosed.set(true);
t.interrupt(); // make sure the ping thread is terminated
}
});
代码示例来源:origin: jenkinsci/jenkins
/** Keep in a separate method so we do not even try to do class loading on {@link PingFailureAnalyzer} from an agent JVM. */
private void analyze(Throwable cause) {
for (PingFailureAnalyzer pfa : PingFailureAnalyzer.all()) {
try {
pfa.onPingFailure(channel, cause);
} catch (IOException ex) {
LOGGER.log(Level.WARNING, "Ping failure analyzer " + pfa.getClass().getName() + " failed for " + channel.getName(), ex);
}
}
}
@Deprecated
代码示例来源:origin: jenkinsci/jenkins
@VisibleForTesting
/*package*/ void install(Channel channel, @CheckForNull SlaveComputer c) {
if (pingTimeoutSeconds < 1 || pingIntervalSeconds < 1) {
LOGGER.warning("Agent ping is disabled");
return;
}
// set up ping from both directions, so that in case of a router dropping a connection,
// both sides can notice it and take compensation actions.
try {
channel.call(new SetUpRemotePing(pingTimeoutSeconds, pingIntervalSeconds));
LOGGER.fine("Set up a remote ping for " + channel.getName());
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to set up a ping for " + channel.getName(), e);
}
setUpPingForChannel(channel, c, pingTimeoutSeconds, pingIntervalSeconds, true);
}
代码示例来源:origin: jenkinsci/jenkins
@Override
protected void onDead(Throwable cause) {
if (analysis) {
analyze(cause);
}
boolean inClosed = isInClosed.get();
// Disassociate computer channel before closing it
if (computer != null) {
Exception exception = cause instanceof Exception ? (Exception) cause: new IOException(cause);
computer.disconnect(new OfflineCause.ChannelTermination(exception));
}
if (inClosed) {
LOGGER.log(Level.FINE,"Ping failed after the channel "+channel.getName()+" is already partially closed.",cause);
} else {
LOGGER.log(Level.INFO,"Ping failed. Terminating the channel "+channel.getName()+".",cause);
}
}
/** Keep in a separate method so we do not even try to do class loading on {@link PingFailureAnalyzer} from an agent JVM. */
代码示例来源:origin: jenkinsci/jenkins
@VisibleForTesting
@Restricted(NoExternalUse.class)
public static void setUpPingForChannel(final Channel channel, final SlaveComputer computer, int timeoutSeconds, int intervalSeconds, final boolean analysis) {
LOGGER.log(Level.FINE, "setting up ping on {0} with a {1} seconds interval and {2} seconds timeout", new Object[] {channel.getName(), intervalSeconds, timeoutSeconds});
final AtomicBoolean isInClosed = new AtomicBoolean(false);
final PingThread t = new PingThread(channel, timeoutSeconds * 1000L, intervalSeconds * 1000L) {
代码示例来源:origin: jenkinsci/remoting
/**
* Constructor.
* @param channel the {@link Channel}.
*/
private Ref(@CheckForNull Channel channel) {
this.name = channel != null ? channel.getName() : "unknown (null reference)";
this.channel = channel;
}
代码示例来源:origin: jenkinsci/remoting
@Override
public void onRead(Channel channel, Command cmd, long blockSize) {
if (logger.isLoggable(level)) {
logger.log(level, channel.getName() + " read " + blockSize + ": " + cmd);
}
}
代码示例来源:origin: jenkinsci/remoting
@Override
public void onWrite(Channel channel, Command cmd, long blockSize) {
if (logger.isLoggable(level)) {
logger.log(level, channel.getName() + " wrote " + blockSize + ": " + cmd);
}
}
代码示例来源:origin: jenkinsci/remoting
public ChannelStateException(@CheckForNull Channel channel, @Nonnull String message) {
super(message);
channelRef = channel != null ? new WeakReference<>(channel) : null;
channelName = channel != null ? channel.getName() : "unknown";
}
代码示例来源:origin: jenkinsci/remoting
public ChannelStateException(@CheckForNull Channel channel, String message, @CheckForNull Throwable cause) {
super(message, cause);
channelRef = channel != null ? new WeakReference<>(channel) : null;
channelName = channel != null ? channel.getName() : "unknown";
}
代码示例来源:origin: jenkinsci/remoting
@Override
public void onJar(Channel channel, File jar) {
if (logger.isLoggable(level)) {
logger.log(level, channel.getName() + " sending " + jar + " of length " + jar.length());
}
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public void onClosed(Channel channel, IOException cause) {
LOGGER.fine("Terminating ping thread for " + channel.getName());
isInClosed.set(true);
t.interrupt(); // make sure the ping thread is terminated
}
});
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/** Keep in a separate method so we do not even try to do class loading on {@link PingFailureAnalyzer} from an agent JVM. */
private void analyze(Throwable cause) {
for (PingFailureAnalyzer pfa : PingFailureAnalyzer.all()) {
try {
pfa.onPingFailure(channel, cause);
} catch (IOException ex) {
LOGGER.log(Level.WARNING, "Ping failure analyzer " + pfa.getClass().getName() + " failed for " + channel.getName(), ex);
}
}
}
@Deprecated
代码示例来源:origin: jenkinsci/remoting
Future<URL> _resolveJarURL(Channel channel) throws IOException, InterruptedException {
JarCache c = channel.getJarCache();
if (c == null) {
throw new IOException(String.format("Failed to resolve a jar %016x%016x. JAR Cache is disabled for the channel %s",
sum1, sum2, channel.getName()));
}
return c.resolve(channel, sum1, sum2);
// throw (IOException)new IOException(String.format("Failed to resolve a jar %016x%016x",sum1,sum2)).initCause(e);
}
代码示例来源:origin: jenkinsci/remoting
public ReaderThread(CommandReceiver receiver) {
super("Channel reader thread: "+channel.getName());
this.receiver = receiver;
setUncaughtExceptionHandler((t, e) -> {
LOGGER.log(Level.SEVERE, "Uncaught exception in SynchronousCommandTransport.ReaderThread " + t, e);
channel.terminate(new IOException("Unexpected reader termination", e));
});
}
代码示例来源:origin: org.jenkins-ci.modules/slave-installer
public static SlaveInstaller createFor(Channel c) throws InterruptedException {
for (SlaveInstallerFactory f : all()) {
try {
SlaveInstaller si = f.createIfApplicable(c);
if (si!=null) return si;
} catch (IOException e) {
LOGGER.log(Level.WARNING, f+" has failed on "+c.getName(),e);
// try the next one
}
}
return null;
}
代码示例来源:origin: jenkinsci/remoting
public void handle(byte[] payload) {
try {
Command cmd = Command.readFrom(channel, payload);
receiver.handle(cmd);
} catch (IOException | ClassNotFoundException e) {
LOGGER.log(Level.WARNING, "Failed to construct Command in channel " + channel.getName(), e);
}
}
代码示例来源:origin: jenkinsci/docker-plugin
/**
* If the build was workflow, get the ID of that channel.
*/
public static Optional<DockerCloud> getCloudForChannel(VirtualChannel channel) {
if( channel instanceof Channel) {
Channel c = (Channel)channel;
Node node = Jenkins.getInstance().getNode( c.getName() );
if (node instanceof DockerTransientNode) {
return Optional.of(((DockerTransientNode) node).getCloud());
}
}
return Optional.empty();
}
代码示例来源:origin: jenkinsci/artifactory-plugin
public static String getAgentName(FilePath ws) {
if (ws.getChannel() != null) {
return ws.getChannel() instanceof LocalChannel ? "Master" : ((Channel) ws.getChannel()).getName();
}
return "Unknown";
}
代码示例来源:origin: jenkinsci/remoting
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
System.setProperty("attack", attack + ">" + getChannelForSerialization().getName());
}
内容来源于网络,如有侵权,请联系作者删除!