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 org.apache.commons.pool2.impl.GenericObjectPool; | |
public class TestPool { | |
public static void main(String[] args) throws Exception { | |
for(int i = 0; i < 10; i++) { | |
GenericObjectPool genericObjectPool = new GenericObjectPool(new MyPoolableObjectFactory()); | |
MyPoolableObject obj = (MyPoolableObject)genericObjectPool.borrowObject(); | |
System.out.println("i : " + i); |
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 org.apache.commons.pool2.BasePooledObjectFactory; | |
import org.apache.commons.pool2.PooledObject; | |
import org.apache.commons.pool2.impl.DefaultPooledObject; | |
public class MyPoolableObjectFactory extends BasePooledObjectFactory<MyPoolableObject> { | |
@Override | |
public MyPoolableObject create() { | |
return new MyPoolableObject(); |
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 MyPoolableObject { | |
private static int id = 0; | |
public MyPoolableObject() { id++; } | |
public int getId() { return id; } | |
} |
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.util.concurrent.*; | |
public class FutureAndCallableExample { | |
public static void main(String[] args) throws InterruptedException, ExecutionException { | |
System.out.println("Main : " + Thread.currentThread().getName()); | |
ExecutorService executorService = Executors.newSingleThreadExecutor(); | |
Callable<String> callable = () -> { | |
System.out.println("Entered Callable"); |
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
find . -name build | xargs rm -rf |
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
-- create install usb on OSX | |
http://computers.tutsplus.com/tutorials/how-to-create-a-bootable-ubuntu-usb-drive-for-pc-on-a-mac--cms-21187 | |
http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx | |
-- 한영전환 | |
http://blog.daum.net/bagjunggyu/154 | |
-- install vmware horizon client | |
http://vdisage.blogspot.kr/2015/01/installing-horizon-view-320-client-on.html |
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
// create file: | |
sudo vim /usr/share/applications/intellij.desktop | |
// add the following | |
[Desktop Entry] | |
Version=13.0 | |
Type=Application | |
Terminal=false | |
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png | |
Name[en_US]=IntelliJ |
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 com.google.common.base.Function; | |
import com.google.common.collect.Iterables; | |
import com.google.common.collect.Lists; | |
import lombok.Data; | |
import org.junit.Before; | |
import org.junit.Test; | |
import javax.annotation.Nullable; | |
import java.util.List; |
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
1. Obtaining an Entity Manager and Persisting an Entity | |
EntityManagerFactory emf = Persistence.createEntityManagerFactory("EmployeeService"); | |
EntityManager em = emf.createEntityManager(); | |
Employee emp = new Employee(130); | |
em.persist(emp); | |
persist가 완료되면 emp 객체는 entity manager의 persistence context에의해 관리된다. | |
2. Finding an Entity | |
Employee emp = em.find(Employee.class, 130); |
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
//String to DateTime | |
//05/28/2014 11:31 | |
DateTimeFormatter fmt = DateTimeFormat.forPattern("MM/dd/yyyy HH:mm"); | |
fmt.parseDateTime("05/28/2014 11:31"); | |
//Date to String | |
DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm"); | |
String sqlTimeString = fmt.print(DateTime.now()); |
NewerOlder