Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

퓨쳐는 여러함수의 결과가 다음 함수의 입력이되어야할시, 여러 함수가 병렬로 연결되며

나중에 여러 함수의 결과를 조합해야하는 파이프라이닝(pipelining)에 좋은 도구입니다.


Future

...

Sample-Scala

draw.io Diagram
bordertrue
viewerToolbartrue
fitWindowfalse
diagramNametrafficService
simpleViewerfalse
width
diagramWidth691
revision1

...

Code Block
languagescala
themeEmacs
titleFuture를 사용
var request = EventRequest(ticketNr)    //요청을만든다
val futureRoute : Future[Route] = Future{
  callEventService(request).event
}.map{ event =>
  val trafficRequest = TrafficRequest{
    destination = event.location,
    arrivalTime = event.time
  )
  callTrafficeService(trafficRequest).route  //교통 루트를 반환한다.
}


Future Sample-C#

Ff963556.dda12864-f9bd-4340-831f-212c4ee8bc4a(en-us,PandP.10).pngImage Added


Code Block
languagec#
themeEmacs
Func<int, int> F1 = x => x + 1;
Func<int, int> F2 = x => x + 1;
Func<int, int> F3 = x => x + 1;
Func<int, int, int> F4 = delegate ( int x, int y ){
     return x + y;
};            

Task<int> futureB = Task.Factory.StartNew<int>(() => F1(1));
int c = F2(1);
int d = F3(c);
int f = F4(futureB.Result, d);


Promice (미래를 위한 약속)

퓨쳐가 읽기전용 용기라고하면, 퓨쳐자체를 반환하는것을 작성하고 싶을때는 Promice를 사용하면 됩니다.

...