AMQP-361 Fix Javadocs for JDK8

JIRA: https://jira.springsource.org/browse/AMQP-361
This commit is contained in:
Gary Russell
2014-01-15 15:01:10 -05:00
parent cbfc7f1292
commit 2fcea29bc4
42 changed files with 383 additions and 114 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,9 @@ public class ConnectionFactoryUtils {
/**
* Release the given Connection by closing it.
*
* @param con The connection.
* @param cf The connection factory.
*/
public static void releaseConnection(Connection con, ConnectionFactory cf) {
if (con == null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import java.util.UUID;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.erlang.OtpIOException;
@@ -86,11 +87,11 @@ public class SingleConnectionFactory implements ConnectionFactory,
private boolean uniqueSelfNodeName = true;
private String selfNodeName;
private final String selfNodeName;
private String cookie;
private String peerNodeName;
private final String peerNodeName;
private OtpSelf otpSelf;
@@ -125,6 +126,7 @@ public class SingleConnectionFactory implements ConnectionFactory,
this.uniqueSelfNodeName = uniqueSelfNodeName;
}
@Override
public Connection createConnection() throws UnknownHostException,
OtpAuthException {
synchronized (this.connectionMonitor) {
@@ -163,6 +165,7 @@ public class SingleConnectionFactory implements ConnectionFactory,
* <p>As this bean implements DisposableBean, a bean factory will
* automatically invoke this on destruction of its cached singletons.
*/
@Override
public void destroy() {
resetConnection();
}
@@ -204,7 +207,8 @@ public class SingleConnectionFactory implements ConnectionFactory,
* Create a JInterface Connection via this class's ConnectionFactory.
*
* @return the new Otp Connection
* @throws OtpAuthException
* @throws OtpAuthException Any.
* @throws IOException Any.
*/
protected Connection doCreateConnection() throws IOException,
OtpAuthException {
@@ -239,6 +243,7 @@ public class SingleConnectionFactory implements ConnectionFactory,
* @see
* org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
@Override
public void afterPropertiesSet() {
Assert.isTrue(this.selfNodeName != null || this.peerNodeName != null,
"'selfNodeName' or 'peerNodeName' is required");
@@ -268,6 +273,7 @@ public class SingleConnectionFactory implements ConnectionFactory,
this.target = target;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
if (method.getName().equals("equals")) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,9 @@ public interface ConnectionCallback<T> {
* Execute any number of operations against the supplied OTP connection,
* possibly returning a result.
*
* @throws Exception We are not sure everything it throws
* @param connection The connection.
* @return The result.
* @throws Exception We are not sure everything it throws.
*/
T doInConnection(Connection connection) throws Exception;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,10 @@ import java.util.ArrayList;
public class Background {
/**
* Execute the command (and its args, ala Runtime.exec), sending the
* output && error streams to the void.
* output and error streams to the void.
*
* @param cmd The command and args.
* @throws IOException Any.
*/
public static void exec(String[] cmd)
throws IOException
@@ -48,12 +51,15 @@ public class Background {
/**
* Execute a command (and its args, ala Runtime.exec)
*
* @param cmd The command and args.
* @param outFile File to send standard out from the process to
* @param appendOut If true, append the file with standard out,
* else truncate or create a new file
* @param errFile File to send standard err from the process to
* @param appendErr If true, append the file with standard error,
* else truncate or create a new file
*
* @throws IOException Any.
*/
public static void exec(String[] cmd,
File outFile, boolean appendOut,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,9 @@ public class Escape {
/**
* Escape a string by quoting the magical elements
* (such as whitespace, quotes, slashes, etc.)
*
* @param in The string to escape.
* @return The escaped string.
*/
public static String escape(String in){
char[] inChars, outChars;
@@ -42,7 +45,7 @@ public class Escape {
if(outChars.length - numOut < 5){
outChars = enlargeArray(outChars);
}
if(Character.isWhitespace(inChars[i]) ||
inChars[i] == '\\' ||
inChars[i] == '\'' ||

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@@ -43,8 +43,8 @@ public class Execute {
private String[] cmdl = null;
private String[] env = null;
private int exitValue = INVALID;
private ExecuteStreamHandler streamHandler;
private ExecuteWatchdog watchdog;
private final ExecuteStreamHandler streamHandler;
private final ExecuteWatchdog watchdog;
private File workingDirectory = null;
private boolean newEnvironment = false;
private Process process;
@@ -53,6 +53,8 @@ public class Execute {
/**
* Find the list of environment variables for this process.
*
* @return The environment.
*/
public static synchronized Vector<String> getProcEnvironment() {
@@ -360,6 +362,8 @@ public class Execute {
* @param cmd a vector of the commands to execute
* @param baseDir the base directory to run from (optional)
* @param timeToWait milliseconds to wait for completion
*
* @return The result.
*/
public static int execute(Vector<String> envVars, Vector<String> cmd, File baseDir, int timeToWait) {
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,11 +15,11 @@
*/
package org.springframework.util.exec;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Used by <code>Execute</code> to handle input and output stream of
* subprocesses.
@@ -33,6 +33,7 @@ public interface ExecuteStreamHandler {
*
* @param os output stream to write to the standard input stream of the
* subprocess
* @throws IOException Any.
*/
void setProcessInputStream(OutputStream os) throws IOException;
@@ -40,6 +41,7 @@ public interface ExecuteStreamHandler {
* Install a handler for the error stream of the subprocess.
*
* @param is input stream to read from the error stream from the subprocess
* @throws IOException Any.
*/
void setProcessErrorStream(InputStream is) throws IOException;
@@ -47,11 +49,14 @@ public interface ExecuteStreamHandler {
* Install a handler for the output stream of the subprocess.
*
* @param is input stream to read from the error stream from the subprocess
* @throws IOException Any.
*/
void setProcessOutputStream(InputStream is) throws IOException;
/**
* Start handling of the streams.
*
* @throws IOException Any.
*/
void start() throws IOException;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,12 +21,14 @@ package org.springframework.util.exec;
* Destroys a process running for too long.
* For example:
* <pre class="code">
* ExecuteWatchdog watchdog = new ExecuteWatchdog(30000);
* Execute exec = new Execute(myloghandler, watchdog);
* exec.setCommandLine(mycmdline);
* int exitvalue = exec.execute();
* if (exitvalue != SUCCESS && watchdog.killedProcess()){
* {@code
* ExecuteWatchdog watchdog = new ExecuteWatchdog(30000);
* Execute exec = new Execute(myloghandler, watchdog);
* exec.setCommandLine(mycmdline);
* int exitvalue = exec.execute();
* if (exitvalue != SUCCESS && watchdog.killedProcess()){
* // it was killed on purpose by the watchdog
* }
* }
* </pre>
@@ -74,6 +76,7 @@ public class ExecuteWatchdog implements Runnable {
* Watches the given process and terminates it, if it runs for too long.
* All information from the previous run are reset.
* @param process the process to monitor. It cannot be <tt>null</tt>
* @param execThread The thread.
* @throws IllegalStateException thrown if a process is still being monitored.
*/
public synchronized void start(Process process, Thread execThread) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,14 +37,15 @@ public class Os {
* Determines if the OS on which Ant is executing matches the
* given OS family.
*
* @param family The OS family type desired<br />
* Possible values:<br />
* @param family The OS family type desired<br>
* Possible values:<br>
* <ul><li>dos</li>
* <li>mac</li>
* <li>netware</li>
* <li>os/2</li>
* <li>unix</li>
* <li>windows</li></ul>
* @return true if the OS is in the family.
* @since 1.5
*/
public static boolean isFamily(String family) {
@@ -55,6 +56,8 @@ public class Os {
* Determines if the OS on which Ant is executing matches the
* given OS name.
*
* @param name The name.
* @return The result.
* @since 1.7
*/
public static boolean isName(String name) {
@@ -65,6 +68,8 @@ public class Os {
* Determines if the OS on which Ant is executing matches the
* given OS architecture.
*
* @param arch The arch.
* @return The result.
* @since 1.7
*/
public static boolean isArch(String arch) {
@@ -75,6 +80,8 @@ public class Os {
* Determines if the OS on which Ant is executing matches the
* given OS version.
*
* @param version The version.
* @return The result.
* @since 1.7
*/
public static boolean isVersion(String version) {
@@ -90,6 +97,7 @@ public class Os {
* @param arch The OS architecture
* @param version The OS version
*
* @return The result.
* @since 1.7
*/
public static boolean isOs(String family, String name, String arch,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
*/
package org.springframework.util.exec;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
@@ -32,7 +32,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
private Thread inputThread;
private Thread errorThread;
private OutputStream out, err;
private final OutputStream out, err;
boolean running=false;
public PumpStreamHandler(OutputStream out, OutputStream err) {
@@ -48,28 +48,33 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
this(System.out, System.err);
}
public void setProcessOutputStream(InputStream is) {
@Override
public void setProcessOutputStream(InputStream is) {
createProcessOutputPump(is, out);
}
public void setProcessErrorStream(InputStream is) {
@Override
public void setProcessErrorStream(InputStream is) {
createProcessErrorPump(is, err);
}
public void setProcessInputStream(OutputStream os) {
@Override
public void setProcessInputStream(OutputStream os) {
}
public void start() {
@Override
public void start() {
inputThread.start();
errorThread.start();
running=true;
}
public void stop() {
@Override
public void stop() {
if( !running ) {
return;
}
@@ -107,6 +112,10 @@ public class PumpStreamHandler implements ExecuteStreamHandler {
/**
* Creates a stream pumper to copy the given input stream to the given output stream.
*
* @param is The input stream.
* @param os The output stream.
* @return The thread.
*/
protected Thread createPump(InputStream is, OutputStream os) {
final Thread result = new Thread(new StreamPumper(is, os));