Skip to content

Instantly share code, notes, and snippets.

View nephilim's full-sized avatar

Dongwook Lee nephilim

View GitHub Profile
@nephilim
nephilim / tos3-ch06.m03.markdown
Created June 17, 2011 04:53
토비의스프링3 6장 4절~5절

6.4

  • 수동 프록시

    • JDK Proxy
      • Proxy.newProxyInstance()
      • new로는 생성 안됨-> 기존의 getBean()으로는 안됨
    • 결론: FactoryBean을 이용해 빈 생성 제어에 관여해야함
  • ProxyFactoryBean

    • ex: TxProxiedParcelDelivertServiceFactoryBean
@nephilim
nephilim / SemaphoreTest.java
Created April 5, 2011 09:45
Semaphore Test
import java.util.Random;
import java.util.concurrent.Semaphore;
import junit.framework.TestCase;
public class SemaphoreTest extends TestCase
{
public void testSemaphore() throws Exception {
Runnable limitedCall = new Runnable() {
@nephilim
nephilim / LatchConditionTest.java
Created April 5, 2011 05:47
concurrency - Conditional Latch
public class LatchConditionTest extends TestCase {
public void testCodition() throws Exception {
final LatchCondition c = new LatchCondition();
Thread thread1 = new Thread() {
@Override
public void run() {
c.waitTillChange();
}
};
@nephilim
nephilim / ReadWriteLockTest.java
Created April 5, 2011 02:13
concurrency - ReadWriteLock
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import junit.framework.TestCase;
public class BasicConcurrentTest extends TestCase {
public void testReadWriteLock() throws Exception {
final Counter c = new Counter();
Thread write1 = new Thread() {
@nephilim
nephilim / gist:794997
Created January 25, 2011 14:44
Q: 다음 init 코드의 문제점은 무엇일까요?
-(id) init
{
if([self initWithFile:@"data.txt"]) {
// ...
}
return self;
}
// 우선 cons 연산자 비슷한 놈을 만들었습니다.
// 이름은 co-ons(코-온스)라 했습니다. :)
// ex) List(1,1,1,2,3) == 1 ~: List(2,3)
object ~: {
def unapply(list:List[Int]):Option[(Int, List[Int])] = {
list match {
case Nil => None;
case x::xs => Some((x, xs.dropWhile( _ == x )));
}
}
scala> case class Person(name:String, isMale: Boolean, children: Person*)
defined class Person
scala> val outsider = Person("Junghoon Byun", true)
outsider: Person = Person(Junghoon Byun,true,WrappedArray())