This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyHikariDataSource extends HikariDataSource{ | |
private final Timer killer = new Timer(); | |
public Connection getConnection() throws SQLException { | |
final Connection c = super.getConnection(); | |
return (Connection) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] { Connection.class }, new MyHandler(c))); | |
} | |
private class MyHandler implements InvocationHandler { | |
private Connection conn; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class InterceptorDataSource { | |
private final InvocationHandler handler; | |
protected InterceptorDataSource(final DataSource delegate) { | |
this.handler = new InvocationHandler() { | |
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { | |
return (method.getName().equals("getConnection")) ? getConnection(delegate) : method.invoke(delegate, args); | |
} | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.zaxxer.hikari; | |
import java.lang.management.ManagementFactory; | |
import javax.management.MBeanServer; | |
import javax.management.MalformedObjectNameException; | |
import javax.management.ObjectName; | |
public class HikariJmxElf | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2013, 2014 Brett Wooldridge | |
* | |
* 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 | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static java.lang.System.currentTimeMillis; | |
import java.sql.Connection; | |
public class HikariTest | |
{ | |
private static String db1 = "test1"; | |
private static String db2 = "test2"; | |
private static int RUNS = 5000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.Collator; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Comparator; | |
import java.util.List; | |
import java.util.Locale; | |
import org.junit.Assert; | |
import org.junit.Test; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
var childProcess = require('child_process') | |
var phantomjs = require('phantomjs') | |
var nodemailer = require("nodemailer"); | |
// create reusable transport method (opens pool of SMTP connections) | |
var smtpTransport = nodemailer.createTransport("SMTP",{ | |
service: "Gmail", | |
auth: { | |
user: "br****@gmail.com", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
page.open('http://store.apple.com/jp/browse/home/specialdeals/mac/imac/27', function(status) { | |
page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function(status) { | |
page.onConsoleMessage = function (msg) { console.log(msg); }; | |
page.evaluate(function() { | |
$( "td.specs" ).each( function(index) { | |
var pattern = /(i5|i7)[\s\S]*(8GB|16GB|32GB)[\s\S]*(Fusion)/mi; | |
var m = $(this).text().match(pattern); | |
if (m != null && m.length > 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String sql = "SELECT ZDeviceLite.device_id," + | |
" ZDeviceLite.ip_address," + | |
" ZDeviceLite.ip_high," + | |
" ZDeviceLite.ip_low," + | |
" ZDeviceLite.hostname," + | |
" ZDeviceLite.network," + | |
" ZDeviceLite.adapter_id," + | |
" ZDeviceLite.device_type," + | |
" ZDeviceLite.vendor_hw," + | |
" ZDeviceLite.model," + |
NewerOlder