본문 바로가기

개발하자

(326)
EJB 설정하기 File-new-EJB Project 로 ejb프로젝트 생성한후 D:\java2\학원교육자료관련\강의자료\EJB3.0\ejb수업\basic\helloEjb\com폴더(예제소스)를 ejbModule에 복붙 웹로직 자르파일 추가하여 에러없애줌 EJB 자르파일로 익스포트하여 저장해둠 자바프로젝트로 프로젝트 하나 생성 src폴더에 D:\java2\학원교육자료관련\강의자료\EJB3.0\ejb수업\basic\helloClient\src\com폴더 복붙 자르파일 세개 추가 하나는 좀전에 ejb자르파일 저장해두었던것을 추가해줌 그러면 에러없어짐 웹로직에 올려서 실행시키면 클라이언트에서 HelloWorld hello = (HelloWorld) ctx.lookup("helloWorld"); 이 부분의 이름과 HelloWo..
Thread.yield(); class AThread extends Thread{ public void run(){ int i; for (i = 0; i
쓰레드 안전하게 종료시키는 방법 class Echo extends Thread { private int waitTime; // in millisecs public Echo(String word, int waitTime) { super(word); this.waitTime = waitTime; } public void run( ) { for(int i=0; i
생산소비패턴2 import java.util.*; class Producer extends Thread{ Resource source; public Producer(String n, Resource s){ super(n); source=s; } public void run(){ for(char ch='A'; ch
생산자 소비자 패턴(서로가 서로를 깨우는) class Echo extends Thread{ private Thread t; Echo(String word){ super(word); } public void setNextThread(Thread t){ this.t=t; } public void run(){ for(int i=0; i
Thread,InterruptedException,join(); class A{ public static void main(String args[]) throws InterruptedException{ B t1=new B(1,50); B t2=new B(51,100); t1.start(); t2.start(); t1.join(); t2.join(); -->join을 해주지 않으면 계산되기전에 끝나버리는 경우가 발생하여 제대로 된 값이 출력되지 않는다. System.out.println(t1.sum+t2.sum);//5050 } } class B extends Thread{ int num1; int num2; int sum=0; int i; B(int n1,int n2){ num1=n1; num2=n2; } public void run(){ for(i=num1;i
synchronized synchronized 미적용시 synchronized 적고 나면 class ManyClient{ StringBuffer str=new StringBuffer("ABCDE"); public static void main(String args[]) throws InterruptedException{ ManyClient mc=new ManyClient(); mc.makeThread("가나다라마"); mc.makeThread("abcde"); Thread.sleep(3000); } public void makeThread(final String s){ Thread t=new Thread(){ public void run(){ addStr(s); } }; t.start(); } public synchronize..
전달할값이 많을때 tag [ex] 전달할값이 많을때 /WEB-INF/tags/header.tag ======================== a.jsp =====