Skip to content

Instantly share code, notes, and snippets.


Carl Harris ceharris

  • Blacksburg, VA, USA
View GitHub Profile
ceharris /
Last active Nov 23, 2016
prospecto collection syntax improvement

This is the current syntax...

mapOfObjects(Role.class, Contributor.class)
    .reference("person", PERSON_SUMMARY_TEMPLATE)
          .reference("responsibleOrganization", ORG_SUMMARY_TEMPLATE)
View gist:25dddcb7049ec8ebf5be31d2c27a9f10
Verifying that "" is my Blockstack ID.

Keybase proof

I hereby claim:

  • I am ceharris on github.
  • I am ceharris ( on keybase.
  • I have a public key whose fingerprint is 5CD3 C1D5 CD3D AC5C 1040 75CC DF48 BD89 3F1F 38CE

To claim this, I am signing this object:

ceharris / jax-rs-web.xml
Created Oct 16, 2014
JAX-RS Application Servlet Mapping
View jax-rs-web.xml
<!-- This gist simply provides the web.xml configuration needed to support JAX-RS endpoints -->
ceharris /
Last active Dec 21, 2015
Using Java with JDOM to write a SOAP header. Either finds and replaces or adds a SOAP header containing a session ID.
package demo;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.Namespace;
import org.jdom2.input.SAXBuilder;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
class AbstractSocketAppender extends ...
implements EventDispatcher, ExceptionHandler {
private SocketConnectorFactory connectorFactory;
private ConnectionRunner connectionRunner;
private Future<?> runnerTask;
public void start() {
// extract method to create connector factory...
ceharris /
Last active Dec 16, 2015
An example of the (non-)effect of Thread.interrupt on a fairly typical long-running task.

I think that Thread.interrupt() sounds more intrusive than it really is. Thread interruption in Java is entirely advisory. Generally a task does not need to go to any effort to avoid being interrupted. Rather, it usually takes some real effort to properly observe the interrupt status in order to exit when interrupted, if such is desired. Short of putting in the effort to observe the thread's interrupt status, I think you'll find that arbitrary tasks are quite resilient in the face of interrupts.

A task can check the thread's interrupt status at any time by calling Thread.isInterrupted(). If you wish to make a runnable task interruptible, your code must occasionally check the interrupt status and exit the run() method if the task has been interrupted. If you don't want your task to be interrupted, simply ignore the thread's interrupt status.

JDK methods that examine the thread's interrupt status are consistently declared to throw InterruptedException, so they are easily identified. I/O calls w