Skip to content

Instantly share code, notes, and snippets.

View jfuerth's full-sized avatar

Jonathan Fuerth jfuerth

View GitHub Profile
@jfuerth
jfuerth / MultiThreadWrite.java
Created January 22, 2013 16:23
Example PerfRunner test that compares file writing performance under a variable number of concurrent threads.
@Test
public void perThread(@Varying(name = "thread", axis = Axis.X, from = 1, to = 10, step = 1) final int threadCount) throws Exception {
// First define the task that needs to be done.
// This task writes a million 'a' characters to a file:
Runnable task = new Runnable() {
@Override
public void run() {
// create temporary file with extension suffix
@jfuerth
jfuerth / 2012-02-announce.html
Last active December 14, 2015 07:09
Draft of TJUG meeting announcement
<h3>** Attention Intrepid Java Enthusiasts **</h3>
<p>
If you wade through the slush to tomorrow night's meeting, your heroic efforts will not go
unrewarded. We have two talks on cutting edge open-source Java performance monitoring tools!
<p>
First, we'll hear from Lucas Berk, a Red Hatter who works on Java tracing and profiling
support within SystemTap[1]. SystemTap is a dynamic, scriptable kernel-space and user-space
probing system for Linux. It can be used directly by end users, or as a back-end for higher
level performance tools.
<p>
<h3>** Attention Intrepid Java Enthusiasts **</h3>
<p>
If you wade through the slush to tomorrow night's meeting, your heroic efforts will not go
unrewarded. We have two talks on cutting edge open-source Java performance monitoring tools!
<p>
First, we'll hear from Lucas Berk, a Red Hatter who works on Java tracing and profiling
support within SystemTap[1]. SystemTap is a dynamic, scriptable kernel-space and user-space
probing system for Linux. It can be used directly by end users, or as a back-end for higher
level performance tools.
<p>
** Attention Intrepid Java Enthusiasts **
If you wade through the slush to tomorrow night's meeting, your heroic efforts will not go
unrewarded. We have two talks on cutting edge open-source Java performance monitoring tools!
First, we'll hear from Lucas Berk, a Red Hatter who works on Java tracing and profiling
support within SystemTap[1]. SystemTap is a dynamic, scriptable kernel-space and user-space
probing system for Linux. It can be used directly by end users, or as a back-end for higher
level performance tools.
@jfuerth
jfuerth / 2012-02-tjug-announce.txt
Created February 27, 2013 15:03
Meeting announcement draft
** Attention Intrepid Java Enthusiasts **
If you wade through the slush to tomorrow night's meeting, your heroic efforts will not go
unrewarded. We have two talks on cutting edge open-source Java performance monitoring tools!
First, we'll hear from Lucas Berk, a Red Hatter who works on Java tracing and profiling
support within SystemTap[1]. SystemTap is a dynamic, scriptable kernel-space and user-space
probing system for Linux. It can be used directly by end users, or as a back-end for higher
level performance tools.
@jfuerth
jfuerth / gist:5207839
Created March 20, 2013 19:45
Error from Errors view when deploying my project with WTP. The module that causes this problem is errai-ui, as of this revision: https://github.com/jfuerth/errai/tree/data-sync/errai-ui
java.util.zip.ZipException: ZIP file must have at least one entry
at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:304)
at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:140)
at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:321)
at org.jboss.ide.eclipse.as.core.server.xpl.ModulePackager.finished(ModulePackager.java:59)
at org.jboss.ide.eclipse.as.core.publishers.PublishUtil.packModuleIntoJar(PublishUtil.java:230)
at org.jboss.ide.eclipse.as.core.publishers.AbstractServerToolsPublisher.createForceZippedChild(AbstractServerToolsPublisher.java:274)
at org.jboss.ide.eclipse.as.core.publishers.AbstractServerToolsPublisher.transferForceZippedChild(AbstractServerToolsPublisher.java:321)
at org.jboss.ide.eclipse.as.core.publishers.AbstractServerToolsPublisher.fullPublish(AbstractServerToolsPublisher.java:235)
at org.jboss.ide.eclipse.as.core.publishers.AbstractServerToolsPublisher.publishModule(AbstractServerToolsPublisher.java:106)
@jfuerth
jfuerth / ExampleThingDeleteMe.java
Created March 25, 2013 20:01
An application scoped bean
package org.jboss.errai.ui.shared;
import javax.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class ExampleThingDeleteMe {
public ExampleThingDeleteMe() {
System.out.println("\n\n\n\n\n\n\n============== WOOOOOOOOOOOOOOO\n\n\n\n\n\n\n\n");
}
@jfuerth
jfuerth / DoubleTrouble.java
Created April 12, 2013 14:34
A simple Java program for exploring the distance between consecutive values of type double. See the comment below for a formatted example of what this program outputs.
public class DoubleTrouble {
public static void main(String[] args) {
long actualValue = 10000000000000001L;
//long actualValue = 9999999999999999L;
//long actualValue = Long.MAX_VALUE;
double d = actualValue;
System.out.println("Exact value: " + actualValue);
System.out.println("Nearest double: " + (long) d);
public static class SessionsContainer implements Serializable {
private final Map<String, Object> sharedAttributes = new HashMap<String, Object>();
private final Map<String, QueueSession> queueSessions = new HashMap<String, QueueSession>();
public QueueSession createSession(final String httpSessionId, final String remoteQueueId) {
final QueueSession qs = new HttpSessionWrapper(this, httpSessionId, remoteQueueId);
queueSessions.put(remoteQueueId, qs);
return qs;
}
@jfuerth
jfuerth / Classes.java
Created May 21, 2013 14:28
Enhanced traceability for things that go into SessionsContainer
static class TraceableMap<K,V> implements Map<K,V> {
private final Map<K, V> backingMap;
private final String name;
TraceableMap(String name, Map<K,V> backingMap) {
this.backingMap = Assert.notNull(backingMap);
this.name = Assert.notNull(name);
}
public void clear() {