-
수동 프록시
- JDK Proxy
- Proxy.newProxyInstance()
- new로는 생성 안됨-> 기존의 getBean()으로는 안됨
- 결론: FactoryBean을 이용해 빈 생성 제어에 관여해야함
- JDK Proxy
-
ProxyFactoryBean
- ex: TxProxiedParcelDelivertServiceFactoryBean
This file contains 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
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()) | |
This file contains 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
// 우선 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 ))); | |
} | |
} |
This file contains 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
-(id) init | |
{ | |
if([self initWithFile:@"data.txt"]) { | |
// ... | |
} | |
return self; | |
} |
This file contains 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.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() { |
This file contains 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 LatchConditionTest extends TestCase { | |
public void testCodition() throws Exception { | |
final LatchCondition c = new LatchCondition(); | |
Thread thread1 = new Thread() { | |
@Override | |
public void run() { | |
c.waitTillChange(); | |
} | |
}; |
This file contains 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.Random; | |
import java.util.concurrent.Semaphore; | |
import junit.framework.TestCase; | |
public class SemaphoreTest extends TestCase | |
{ | |
public void testSemaphore() throws Exception { | |
Runnable limitedCall = new Runnable() { |
This file contains 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 pis.chap22.multimap | |
import org.junit.runner.RunWith | |
import org.scalatest.Spec | |
import org.scalatest.junit.JUnitRunner | |
@RunWith(classOf[JUnitRunner]) | |
class LasMultiMapSpec extends Spec { | |
describe("정의한 LasDan MultiMap의 기본 동작을 확인한다") { | |
it ("기본 동작") { |
This file contains 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 func = function() { | |
if ( !func.cache ) { | |
console.log("cache initialized @" + new Date()); | |
func.cache = "complex result"; | |
} | |
return func.cache; | |
}; | |
var func2 = func; | |
OlderNewer