Skip to content

Instantly share code, notes, and snippets.

[#|2011-01-05T13:48:24.084-0500|INFO|glassfish3.1|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=68;_ThreadName=AutoDeployer;|[AutoDeploy] Selecting file /Users/jfarcand/workspace/atmosphere/container/glassfish3/glassfish/domains/domain1/autodeploy/grizzly-websockets-chat-1.9.27.war for autodeployment.|#]
[#|2011-01-05T13:48:24.515-0500|INFO|glassfish3.1|org.hibernate.validator.util.Version|_ThreadID=68;_ThreadName=AutoDeployer;|Hibernate Validator 4.1.0.Final|#]
[#|2011-01-05T13:48:24.520-0500|INFO|glassfish3.1|org.hibernate.validator.engine.resolver.DefaultTraversableResolver|_ThreadID=68;_ThreadName=AutoDeployer;|Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.|#]
[#|2011-01-05T13:48:25.053-0500|INFO|glassfish3.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=68;_ThreadName=AutoDeployer;|WEB0671: Loading application [grizzly-websockets-chat-1.9.27] at [/grizzly-websockets-chat]|#]
[#|2011-01-05T13:48
[#|2011-01-05T14:04:34.742-0500|SEVERE|glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=85;_ThreadName=Thread-35;|java.io.IOException: Cannot bind to URL [rmi://192.168.2.1:8686/jmxrmi]: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: Exception creating connection to: 192.168.2.1; nested exception is:
java.net.SocketException: Cannot allocate memory]
at javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:804)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:417)
at org.glassfish.admin.mbeanserver.RMIConnectorStarter.start(RMIConnectorStarter.java:309)
at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.startConnector(JMXStartupService.java:243)
at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.run(JMXStartupService.java:283)
Caused by: javax.naming.CommunicationExceptio
@jfarcand
jfarcand / gist:768469
Created January 6, 2011 20:00
SimpleAsyncHttpClient
public interface SimpleAsyncHttpClient {
public Future<Response> upload(String uri, File file);
public Future<Response> upload(String uri, InputStream stream);
public Future<Response> upload(String uri, BodyGenerator bodyGenerator) ;
public Future<Response> upload(Request request, File file) ;
@jfarcand
jfarcand / gist:769494
Created January 7, 2011 14:16
Friday's Fun: Comparing Apache Http Client with AsyncHttpClient
Configuring Apache Client
HttpParams params = new BasicHttpParams();
params.setParameter(HttpProtocolParams.PROTOCOL_VERSION,
HttpVersion.HTTP_1_1);
params.setBooleanParameter(HttpProtocolParams.USE_EXPECT_CONTINUE,
false);
params.setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK,
false);
params.setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE,
public final static String getBaseUrl(URI uri) {
String url = uri.getScheme() + "://" + uri.getAuthority();
int port = uri.getPort();
if (port == -1) {
port = getPort(uri);
url += ":" + port;
}
return url;
}
@jfarcand
jfarcand / gist:770187
Created January 7, 2011 21:57
AsyncHttpClient Simplified API
// SimpleAsyncHttpClient class API:
public Future<Response> post(BodyGenerator bodyGenerator) throws IOException ;
public Future<Response> post(BodyGenerator bodyGenerator, BodyConsumer bodyConsumer) throws IOException ;
public Future<Response> put(BodyGenerator bodyGenerator, BodyConsumer bodyConsumer) throws IOException ;
public Future<Response> put(BodyGenerator bodyGenerator) throws IOException ;
package org.sonatype.addressbook;
import java.util.Collection;
import org.sonatype.addressbook.model.Person;
public interface AddressBook
{
//POST
@Path("/services/{handler}")
public class ServerHandler {
@POST
public Response service(@Context Request request, @ServiceHandler(POST, "createPerson(entity)") ServiceHandler serviceHandler){
return serviceHandler.delegate(request);
}
}
@Path("/service/:type")
@Produces({APPLICATION_JSON, APPLICATION_XML})
@Consumes({APPLICATION_JSON, APPLICATION_XML})
public class ServiceDescriptionResource {
@Inject
ServiceEntity delegate;
@POST
// Service Definition
ServiceDefinition serviceDefinition = injector.getInstance(ServiceDefinition.class);
serviceDefinition
.producing(ServiceDefinition.Media.JSON)
.producing(ServiceDefinition.Media.XML)
.consuming(ServiceDefinition.Media.JSON)
.consuming(ServiceDefinition.Media.XML)
.withHandler(new ServiceHandler(ServiceDefinition.HttpMethod.PUT, "id", "createAddressBook"))
.withHandler(new ServiceHandler(ServiceDefinition.HttpMethod.GET, "id", "getAddressBook"))