Skip to content

Instantly share code, notes, and snippets.

View stuartwdouglas's full-sized avatar

Stuart Douglas stuartwdouglas

  • Red Hat
  • Orange NSW Australia
View GitHub Profile
@Produces
@SomeQualifier
public Dools setupDroolsConfig()
{
//set up the configuration and return it.
//any producer that returns a Drools automatically installs a
//set of generic beans with the same qualifier
}
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
b() {
cd /Users/stuartdouglas/workspace/jboss-as
cd $1
mvn install
cp target/*.jar ../build/target/$JBOSS_VERSION/modules/org/jboss/as/$1/main
}
<subsystem name="undertow" >
<worker accept-threads="5" read-threads="5" write-threads="5" >
<high-water-mark value="10000" />
... more options....
</worker>
<http-listener name="listener1" socket="my-binding" handler="myHandlerChain">
<tcp-nodelay value="true" >
</http-listener>
Working backwards:
HEAD(Effectivly 'Use our LTQ') = 96k
Do not use linked transfer queue in the buffer pool = 117k
Add a per-thread queue to the buffer pool = 110k
Fix problem where class cannot be linked due to a catch clause for a missing exception type = 108k
@stuartwdouglas
stuartwdouglas / gist:4984372
Last active December 13, 2015 22:28
Unicorn by Stack Trace Inspection
public class MagicLand {
static {
try {
Field field = Math.class.getDeclaredField("randomNumberGenerator");
field.setAccessible(true);
field.set(null, new Random() {
@Override
public double nextDouble() {
return 0;
@stuartwdouglas
stuartwdouglas / gist:4984406
Created February 19, 2013 09:38
Unicorn by stack trace inspection
public class MagicLand {
public static void main(String[] args) {
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE");
}
}
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
@stuartwdouglas
stuartwdouglas / gist:4984419
Last active December 13, 2015 22:29
Unicorn meat by horrible reflection hack
public class MagicLand {
static {
try {
Field field = Math.class.getDeclaredField("randomNumberGenerator");
field.setAccessible(true);
field.set(null, new Random() {
@Override
public double nextDouble() {
return 0;
@stuartwdouglas
stuartwdouglas / gist:5e157cffa18676df28691c6088ce2b25
Created June 8, 2016 06:47
Commands to get mod_cluster running
:stop-servers
/server-group=lb:add(profile=load-balancer, socket-binding-group=load-balancer-sockets)
/host=master/server-config=la:add(group=lb)
/server-group=ha:add(profile=ha, socket-binding-group=ha-sockets)
/host=master/server-config=s1:add(group=ha, socket-binding-port-offset=100)
deploy ~/workspace/modcluster-example/load-balancing-demo/target/clustering-demo.war --server-groups=ha
/server-group=ha:start-servers
/server-group=lb:start-servers
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
/**
* @author Stuart Douglas
*/
@WebListener
public class SessionIDChangeListener implements ServletContextListener {
@Override