锘??xml version="1.0" encoding="utf-8" standalone="yes"?>在线不卡的av,992tv在线,天堂аⅴ在线最新版在线http://www.aygfsteel.com/SunRiver/Topics about Java SE, Servlet/JSP, JDBC, MultiThread, UML, Design Pattern, CSS, JavaScript, Maven, JBoss, Tomcat, ...zh-cnTue, 06 May 2025 04:53:01 GMTTue, 06 May 2025 04:53:01 GMT60Java Faqs 2http://www.aygfsteel.com/SunRiver/archive/2010/10/25/336111.htmlSun RiverSun RiverMon, 25 Oct 2010 09:08:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2010/10/25/336111.html

Question How do you delete a Cookie within a JSP? (JSP)

Answer

Cookie mycook = new Cookie("name","value");

response.addCookie(mycook);

Cookie killmycook = new Cookie("mycook","value");

killmycook.setMaxAge(0);

killmycook.setPath("/");

killmycook.addCookie(killmycook);

Question How many types of protocol implementations does RMI have? (RMI)

Answer RMI has at least three protocol implementations: Java

Remote Method Protocol(JRMP), Internet Inter ORB Protocol(IIOP),

and Jini Extensible Remote Invocation(JERI). These are alternatives,

not part of the same thing, All three are indeed layer 6 protocols for

those who are still speaking OSI reference model.

Question What are the different identifier states of a Thread?

(Core Java)

Answer The different identifiers of a Thread are:

R - Running or runnable thread

S - Suspended thread

CW - Thread waiting on a condition variable

MW - Thread waiting on a monitor lock

MS - Thread suspended waiting on a monitor lock


Question What is the fastest type of JDBC driver? (JDBC)

Answer JDBC driver performance will depend on a number of

issues:

(a) the quality of the driver code,

(b) the size of the driver code,

(c) the database server and its load,

(d) network topology,

(e) the number of times your request is translated to a different API.

In general, all things being equal, you can assume that the more your

request and response change hands, the slower it will be. This

means that Type 1 and Type 3 drivers will be slower than Type 2

drivers (the database calls are make at least three translations versus

two), and Type 4 drivers are the fastest (only one translation).

Question Request parameter How to find whether a parameter

exists in the request object? (Servlets)

Answer 1.boolean hasFoo = !(request.getParameter("foo") ==

null || request.getParameter("foo").equals(""));

2. boolean hasParameter =

request.getParameterMap().contains(theParameter);

(which works in Servlet 2.3+)


Question How can I send user authentication information while

makingURLConnection? (Servlets)

Answer You’ll want to use

HttpURLConnection.setRequestProperty and set all the appropriate

headers to HTTP authorization.

Question How do I convert a numeric IP address like 192.18.97.39

into a hostname like java.sun.com? (Networking)

Answer

Question How many methods do u implement if implement the

Serializable Interface? (Core Java)

Answer The Serializable interface is just a "marker" interface,

with no methods of its own to implement. Other ’marker’ interfaces

are

java.rmi.Remote

java.util.EventListener

String hostname =InetAddress.getByName("192.18.97.39").getHostName();



Sun River 2010-10-25 17:08 鍙戣〃璇勮
]]>
Java Faqs 1http://www.aygfsteel.com/SunRiver/archive/2010/10/25/336099.htmlSun RiverSun RiverMon, 25 Oct 2010 08:07:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2010/10/25/336099.html

Question What is the query used to display all tables names in

SQL Server (Query analyzer)? (JDBC)

Answer select * from information_schema.tables

Question What is Externalizable? (Core Java)

Answer Externalizable is an Interface that extends Serializable

Interface. And sends data into Streams in Compressed Format. It has

two methods, writeExternal(ObjectOuput out) and

readExternal(ObjectInput in).

Question What modifiers are allowed for methods in an Interface?

Answer Only public and abstract modifiers are allowed for

methods in interfaces.

Question How many types of JDBC Drivers are present and what

are they? (JDBC)

Answer There are 4 types of JDBC Drivers

Type 1: JDBC-ODBC Bridge Driver

Type 2: Native API Partly Java Driver

Type 3: Network protocol Driver

Type 4: JDBC Net pure Java Driver

Question What is the difference between ServletContext and

PageContext? (JSP)

Answer ServletContext: Gives the information about the container

PageContext: Gives the information about the Request.

Question How to pass information from JSP to included JSP?

Answer Using <%jsp:param> tag.



Sun River 2010-10-25 16:07 鍙戣〃璇勮
]]>
tomcat6閰嶇疆httpshttp://www.aygfsteel.com/SunRiver/archive/2010/05/11/320579.htmlSun RiverSun RiverTue, 11 May 2010 04:12:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2010/05/11/320579.html 

tomcat6閰嶇疆鍙屽悜璁よ瘉

1
銆佺敓鎴愭湇鍔″櫒绔瘉涔?/span>

keytool -genkey -keyalg RSA -dname "cn=localhost,ou=sango,o=none,l=china,st=beijing,c=cn" -alias server -keypass password -keystore server.jks -storepass password -validity 3650


2
銆佺敓鎴愬鎴風璇佷功

keytool -genkey -keyalg RSA -dname "cn=sango,ou=sango,o=none,l=china,st=beijing,c=cn" -alias custom -storetype PKCS12 -keypass password -keystore custom.p12 -storepass password -validity 3650


瀹㈡埛绔殑CN鍙互鏄換鎰忓箋?/span>
3
銆佺敱浜庢槸鍙屽悜SSL璁よ瘉錛屾湇鍔″櫒蹇呴』瑕佷俊浠誨鎴風璇佷功錛屽洜姝わ紝蹇呴』鎶婂鎴風璇佷功娣誨姞涓烘湇鍔″櫒鐨勪俊浠昏璇併傜敱浜庝笉鑳界洿鎺ュ皢PKCS12鏍煎紡鐨勮瘉涔﹀簱瀵煎叆錛屾垜浠繀欏誨厛鎶婂鎴風璇佷功瀵煎嚭涓轟竴涓崟鐙殑CER鏂囦歡錛屼嬌鐢ㄥ涓嬪懡浠わ紝鍏堟妸瀹㈡埛绔瘉涔﹀鍑轟負涓涓崟鐙殑cer鏂囦歡錛?/span>

keytool -export -alias custom -file custom.cer -keystore custom.p12 -storepass password -storetype PKCS12 -rfc


鐒跺悗錛屾坊鍔犲鎴風璇佷功鍒版湇鍔″櫒涓紙灝嗗凡絳懼悕鏁板瓧璇佷功瀵煎叆瀵嗛挜搴擄級

keytool -import -v -alias custom -file custom.cer -keystore server.jks -storepass password


4
銆佹煡鐪嬭瘉涔﹀唴瀹?/span>

keytool -list -v -keystore server.jks -storepass password


5
銆侀厤緗?/span>tomcat service.xml鏂囦歡

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    clientAuth="true" sslProtocol="TLS"
    keystoreFile="D:/server.jks" keystorePass="password"
    truststoreFile="D:/server.jks" truststorePass="password"
/>


clientAuth="true"
琛ㄧず鍙屽悜璁よ瘉
6
銆佸鍏ュ鎴風璇佷功鍒版祻瑙堝櫒
鍙屽悜璁よ瘉闇瑕佸己鍒墮獙璇佸鎴風璇佷功銆傚弻鍑?/span>“custom.p12”鍗沖彲灝嗚瘉涔﹀鍏ヨ嚦IE

tomcat6
閰嶇疆鍗曞悜璁よ瘉

1
銆佺敓鎴愭湇鍔″櫒绔瘉涔?/span>

keytool -genkey -keyalg RSA -dname "cn=localhost,ou=sango,o=none,l=china,st=beijing,c=cn" -alias server -keypass password -keystore server.jks -storepass password -validity 3650


2
銆佺敱浜庢槸鍗曞悜璁よ瘉錛屾病鏈夊繀瑕佺敓鎴愬鎴風鐨勮瘉涔︼紝鐩存帴榪涘叆閰嶇疆tomcat service.xml鏂囦歡

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    clientAuth="false" sslProtocol="TLS"
    keystoreFile="D:/server.jks" keystorePass="password"    
/>


clientAuth="false"
琛ㄧず鍗曞悜璁よ瘉錛屽悓鏃跺幓鎺?/span>truststoreFile="D:/server.jks" truststorePass="password"榪?/span>2



Sun River 2010-05-11 12:12 鍙戣〃璇勮
]]>
Difference between class and id in CSShttp://www.aygfsteel.com/SunRiver/archive/2010/03/16/315552.htmlSun RiverSun RiverTue, 16 Mar 2010 02:14:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2010/03/16/315552.html---The key thing to know is that IDs identify a specific element and therefore must be unique on the page – you can only use a specific ID once per document. Many browsers do not enforce this rule but it is a basic rule of HTML/XHTML and should be observed. Classes mark elements as members of a group and can be used multiple times, so if you want to define a style which will be applied to multiple elements you should use a class instead.

 Notice that an ID's CSS is an HTML element, followed by a "#", and finally ID's name. The end result looks something like "element#idname". Also, be sure to absorb the fact that when an ID is used in HTML, we must use "id=name" instead of "class=name" to reference it!

Why Did They Choose Those Names??

       ID = A person's Identification (ID) is unique to one person.

       Class = There are many people in a class.

ID for Layout and Uniqueness

Standards specify that any given ID name can only be referenced once within a page or document. From our experience, IDs are most commonly used correctly in CSS layouts. This makes sense because there are usually only one menu per page, one banner, and usually only one content pane.

In Tizag.com CSS Layout Examples we have used IDs for the unique items mentioned above. View the CSS Code for our first layout example. Below are the unique IDs in our code.

*       Menu - div#menuPane

*       Content - div#content

Answer: Classes vs IDs

Use IDs when there is only one occurence per page. Use classes when there are one or more occurences per page.



Sun River 2010-03-16 10:14 鍙戣〃璇勮
]]>
Web涓璼ingleton鐨勮寖鍥?spring涓璼ingleton鐨勮寖鍥?/title><link>http://www.aygfsteel.com/SunRiver/archive/2009/04/08/264426.html</link><dc:creator>Sun River</dc:creator><author>Sun River</author><pubDate>Wed, 08 Apr 2009 04:12:00 GMT</pubDate><guid>http://www.aygfsteel.com/SunRiver/archive/2009/04/08/264426.html</guid><description><![CDATA[--Spring鐨剆ingleton鏄鍣ㄧ駭鐨勶紝鎴戜滑涓鑸鐨剆ingleton妯″紡鏄疛VM綰х殑銆傛墍浠ingleton妯″紡涓紝singleton鐨刢lass鍦ㄦ暣涓狫VM涓彧鏈変竴涓猧nstance錛孲pring鐨凚ean錛屼綘鍙互涓涓猚lass閰嶇疆澶氫釜Bean錛岃繖涓猚lass灝辨湁浜嗗涓猧nstance銆傝繖涓猻ingleton鏄寚鍦╯pring瀹瑰櫒涓紝榪欎釜Bean鏄崟瀹炰緥鐨勶紝鏄嚎紼嬪叡浜殑銆傛墍浠ヨ姹傝繖浜涚被閮芥槸綰跨▼瀹夊叏鐨勩備篃灝辨槸璇達紝涓嶈兘鍑虹幇淇敼Bean灞炴х殑鏂規硶錛屽綋鐒墮櫎浜嗚鍊煎緱閭d簺setter銆傚彧瑕佹弧瓚崇嚎紼嬪畨鍏紝榪欎簺bean閮藉彲浠ョ敤singleton銆傝屼笖鎴戜滑鍦ㄧ粷澶у鏁頒嬌鐢ㄤ笂錛屼篃鏄繖鏍風敤鐨勶紝鍖呮嫭dao,service銆?br /> Beanfactory鏄疭pring鍒濆浠ラ潤鎬佹柟寮忚澆鍏ョ殑,Spring鐨勫崟渚婭OC鏄熀浜庡鍣ㄧ駭鐨?鎵浠ヨ繖浣犻兘涓嶇敤鎷呭績涓庤冭檻.<br /> <br /> --搴旂敤涓璞℃湁涓ょ錛岃涓哄璞″拰鏁版嵁瀵硅薄錛岃涓哄璞¢兘瑕佹眰鏄嚎紼嬪畨鍏ㄧ殑錛佷篃灝辨槸鍏佽鍗曚緥鐨? 涓嶇鏄痙ao 榪樻槸 service 瀵硅薄錛岄兘鏄涓哄璞★紝琛屼負瀵硅薄涓嶅簲璇ュ紩鐢ㄩ潪綰跨▼瀹夊叏鐨勫璞″仛鎴愬憳閲忥紝鍚屾椂鍦ㄥ簲鐢ㄥ閮ㄧ殑璧勬簮錛堝鏂囦歡錛屾暟鎹簱榪炴帴錛宻ession錛夋椂錛岃鍏堜繚璇佸榪欎簺涓滆タ鐨勮闂槸鍋氫簡騫跺彂鎺у埗鐨勶紒<br />   瀵逛簬spring鏉ヨ錛?lt;bean scope="singleton"/>鎴?lt;bean singleton="true"/>閮芥槸淇濊瘉瀵瑰悓涓sesionfactory bean鏄崟渚嬬殑錛屼篃灝辨槸鎵璋?sessionfactory 鑼冨洿鐨?<br /> <br /> --榪欐槸涓涓湡瀹炵殑妗堜緥錛屾垜浠湪欏圭洰涓嬌鐢⊿pring鍜孉CEGI,鎴戜箣鎵浠ラ夋嫨ACEGI錛岄櫎浜嗗畠瀵規潈闄愮殑鑹ソ鎺у埗澶栵紝 <br /> 鎴戣繕鐪嬪ソ瀹冪殑SecurityContextHolder錛岄氳繃浠g爜 <br /> <div id="wmqeeuq" class="code_title">浠g爜</div> <div id="wmqeeuq" class="code_div"> <div id="wmqeeuq" class="dp-highlighter"> <ol class="dp-j"> <li id="wmqeeuq" class="alt"><span><span>Authentication auth = SecurityContextHolder.getContext().getAuthentication();   </span></span> </li> </ol> </div> </div> <script>render_code();</script><br /> 鎴戝彲浠ュ緢瀹規槗鍦ㄧ郴緇熶換鎰忎竴灞傚緱鍒扮敤鎴風殑淇℃伅錛岃屼笉鐢ㄦ妸鐢ㄦ埛淇℃伅鍦ㄥ弬鏁伴噷浼犳潵浼犲幓錛?榪欎篃鏄痵truts鐨勭己鐐逛箣涓) <br /> 浣嗘槸鎴戝湪姣忎竴嬈¤寰楀埌鐢ㄦ埛淇℃伅鐨勬椂鍊欓兘鍐欎笂闈㈢殑涓孌典唬鐮侊紝鏈厤鏈変簺楹葷儲錛屾墍浠ユ垜鍦˙aseService, BaseDao閲岄兘鎻愪緵浜嗗涓嬫柟娉曪細 <br /> <div id="wmqeeuq" class="code_title">浠g爜</div> <div id="wmqeeuq" class="code_div"> <div id="wmqeeuq" class="dp-highlighter"> <div id="wmqeeuq" class="bar"> <ol class="dp-j"> <li id="wmqeeuq" class="alt"><span><span> </span><span id="wmqeeuq" class="comment">/** </span> </span> <li id="wmqeeuq" class=""><span><span id="wmqeeuq" class="comment"> * get current login user info </span> </span> <li id="wmqeeuq" class="alt"><span><span id="wmqeeuq" class="comment"> * @return UserInfo </span> </span> <li id="wmqeeuq" class=""><span><span id="wmqeeuq" class="comment"> */</span><span>  </span></span> <li id="wmqeeuq" class="alt"><span><span id="wmqeeuq" class="keyword">protected</span><span> UserInfo getUserInfo()   </span> <li id="wmqeeuq" class=""><span>{   </span> <li id="wmqeeuq" class="alt"><span>    </span><span id="wmqeeuq" class="keyword">return</span><span> getUserContext().getUserInfo();   </span> <li id="wmqeeuq" class=""><span>}   </span> <li id="wmqeeuq" class="alt"><span>  </span> <li id="wmqeeuq" class=""><span><span id="wmqeeuq" class="comment">/** </span>  <li id="wmqeeuq" class="alt"><span><span id="wmqeeuq" class="comment"> * get current login user context </span> </span> <li id="wmqeeuq" class=""><span><span id="wmqeeuq" class="comment"> * @return UserContext </span> </span> <li id="wmqeeuq" class="alt"><span><span id="wmqeeuq" class="comment"> */</span><span>  </span></span> <li id="wmqeeuq" class=""><span><span id="wmqeeuq" class="keyword">protected</span><span> UserContext getUserContext()   </span> <li id="wmqeeuq" class="alt"><span>{   </span> <li id="wmqeeuq" class=""><span>    Authentication auth = SecurityContextHolder.getContext().getAuthentication();   </span> <li id="wmqeeuq" class="alt"><span>    </span><span id="wmqeeuq" class="keyword">return</span><span> (UserContext) auth.getPrincipal();   </span> <li id="wmqeeuq" class=""><span>}   </span> </li> </ol> </div> </div> <script>render_code();</script><br /> 榪欐牱鍦ㄥ叾浠栫殑Service鍜孌ao綾婚噷鍙互閫氳繃 <br /> <div id="wmqeeuq" class="code_title">浠g爜</div> <div id="wmqeeuq" class="code_div"> <div id="wmqeeuq" class="dp-highlighter"> <div id="wmqeeuq" class="bar"> <ol class="dp-j"> <li id="wmqeeuq" class="alt"><span><span id="wmqeeuq" class="keyword">super</span><span>.getUserContext(), </span><span id="wmqeeuq" class="keyword">super</span><span>.getUserInfo()   </span></span> </li> </ol> </div> </div> <script>render_code();</script><br /> 鏉ュ緱鍒扮敤鎴風殑淇℃伅錛岃繖涔熶負闂鐨勪駭鐢熸彁渚涗簡娓╁簥銆傝鐪嬪涓嬩唬鐮侊細 <br /> <div id="wmqeeuq" class="code_title">浠g爜</div> <div id="wmqeeuq" class="code_div"> <div id="wmqeeuq" class="dp-highlighter"> <div id="wmqeeuq" class="bar"> <ol class="dp-j"> <li id="wmqeeuq" class="alt"><span><span id="wmqeeuq" class="keyword">public</span><span> </span><span id="wmqeeuq" class="keyword">class</span><span> SomeServece </span><span id="wmqeeuq" class="keyword">extends</span><span> BaseService </span><span id="wmqeeuq" class="keyword">implements</span><span> SomeInterFace     </span></span> <li id="wmqeeuq" class=""><span>{   </span> <li id="wmqeeuq" class="alt"><span>    </span><span id="wmqeeuq" class="keyword">private</span><span> UserInfo user = </span><span id="wmqeeuq" class="keyword">super</span><span>.getUserInfo();   </span> <li id="wmqeeuq" class=""><span>       </span> <li id="wmqeeuq" class="alt"><span>    </span><span id="wmqeeuq" class="keyword">public</span><span> someMethod()   </span> <li id="wmqeeuq" class=""><span>    {   </span> <li id="wmqeeuq" class="alt"><span>       </span><span id="wmqeeuq" class="keyword">int</span><span> userID = </span><span id="wmqeeuq" class="keyword">this</span><span>.user.getUserID();   </span> <li id="wmqeeuq" class=""><span>       String userName = </span><span id="wmqeeuq" class="keyword">this</span><span>.user.getUserName();   </span> <li id="wmqeeuq" class="alt"><span>       </span><span id="wmqeeuq" class="comment">//bla bla do something user userID and userNaem </span><span>  </span> <li id="wmqeeuq" class=""><span>    }   </span> <li id="wmqeeuq" class="alt"><span>}       </span> </li> </ol> </div> </div> <script>render_code();</script> <p> </p> <p>榪欐浠g爜鍦ㄥ崟鍏冩祴璇曠殑鏃跺欎笉浼氱敤浠諱綍闂錛屼絾鏄湪澶氱敤鎴鋒祴璇曠殑鎯呭喌涓嬶紝浣犱細鍙戠幇浠諱綍璋冪敤SomeService閲宻omeMethod()鏂規硶 <br /> 鐨剈serID鍜寀serName閮芥槸鍚屼竴涓漢錛屼篃灝辨槸絎竴涓櫥闄嗙殑浜虹殑淇℃伅銆俉hy? <br /> <strong><br /> 鍏舵牴鏈師鍥犳槸Spring鐨凚ean鍦ㄩ粯璁ゆ儏鍐典笅鏄疭ingleton鐨勶紝Bean SomeServece鐨勫疄渚嬪彧浼氱敓鎴愪竴浠斤紝涔熷氨鏄墍SomeServece瀹炰緥鐨剈ser <br /> 瀵硅薄鍙細琚垵濮嬪寲涓嬈★紝灝辨槸絎竴嬈$櫥闄嗕漢鐨勪俊鎭紝浠ュ悗涓嶄細鍙樹簡銆傛墍浠aseService鎯充負寮鍙戞彁渚涙柟渚匡紝鍗寸粰寮鍙戝甫鏉ヤ簡椋庨櫓 <br /> </strong><br /> 姝g‘鐨勭敤娉曞簲璇ユ槸榪欐牱鐨?<br /> </p> <div id="wmqeeuq" class="code_title">浠g爜</div> <div id="wmqeeuq" class="code_div"> <div id="wmqeeuq" class="dp-highlighter"> <div id="wmqeeuq" class="bar"> <ol class="dp-j"> <li id="wmqeeuq" class="alt"><span><span id="wmqeeuq" class="keyword">public</span><span> </span><span id="wmqeeuq" class="keyword">class</span><span> SomeServece </span><span id="wmqeeuq" class="keyword">extends</span><span> BaseService </span><span id="wmqeeuq" class="keyword">implements</span><span> SomeInterFace     </span></span> <li id="wmqeeuq" class=""><span>{   </span> <li id="wmqeeuq" class="alt"><span>       </span> <li id="wmqeeuq" class=""><span>       </span> <li id="wmqeeuq" class="alt"><span>    </span><span id="wmqeeuq" class="keyword">public</span><span> someMethod()   </span> <li id="wmqeeuq" class=""><span>    {   </span> <li id="wmqeeuq" class="alt"><span>       </span><span id="wmqeeuq" class="keyword">int</span><span> userID = </span><span id="wmqeeuq" class="keyword">super</span><span>.getUserInfo().getUserID();   </span> <li id="wmqeeuq" class=""><span>       String userName = </span><span id="wmqeeuq" class="keyword">super</span><span>.getUserInfo().getUserName();   </span> <li id="wmqeeuq" class="alt"><span>       </span><span id="wmqeeuq" class="comment">//bla bla do something user userID and userNaem </span><span>  </span> <li id="wmqeeuq" class=""><span>    }   </span> </li> </ol> </div> </span></span></span></div> </div> </div> </div> </div> <img src ="http://www.aygfsteel.com/SunRiver/aggbug/264426.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/SunRiver/" target="_blank">Sun River</a> 2009-04-08 12:12 <a href="http://www.aygfsteel.com/SunRiver/archive/2009/04/08/264426.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Java Architect Issue -2-http://www.aygfsteel.com/SunRiver/archive/2009/03/17/260207.htmlSun RiverSun RiverTue, 17 Mar 2009 03:51:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2009/03/17/260207.htmlArchitect (Java) Interview Questions

General and general terms questions

Architect interview is slightly different from all other interview types. Interviewer is looking for ability of the candidate to think independently on top of pure technical knowledge. Most of the questions are open-ended, prompting the interviewee to discussion about different aspects of Java development. Other side of the interview is general questions about position of the architect within the organization. Some questions do not have clear, direct or single answer and require discussion with the interviewer. On top of questions mentioned here you may be asked generic OO questions (what is class, what is polymorphism etc.)
  1. What distinguishes "good architecture" from "bad architecture"?
    This is an open-ended question. There are few aspects of "good" architecture:
    1. Shall address functional product requirements
    2. Shall address non-functional product requirements, such as performance, scalability, reliability, fault tolerance, availability, maintainability, extensibility
    3. Shall be simple and comprehendible (to support maintainability and extensibility)
    4. Shall be well structured (support multiple tiers, parallel development etc.)
    5. Shall be detailed enough to share with different levels of organizational structure (marketing, sales, development, management)
    "Bad" architecture is basically opposite to "good" architecture.
  2. How much experience do you have with Enterprise applications? Another variant of this questions is: "Tell me about projects where you worked with J2EE?" Yet another version: "What, when and how made using EJB?"
    Interviewer is looking for your experience with designing J2EE applications and your experience with J2EE technologies and general terms. This is often start of the discussion and bridge to the technical section of the questions.
  3. What is scalability?
  4. What is high-availability? How is it different from scalability?
  5. What is the fault tolerance?
  6. What resources are used to keep up to date with J2EE technology?
    You may mention design pattern books, such as "Core EJB Patterns" and web sites, such as http://www.theserverside.com

Specific technical questions

  1. What modeling tools you are familiar with? What version of TogetherJ (Rational Rose etc.) have you used?
  2. If stateless session bean more scalable than stateful session beans?
    This is very popular questions that leads to some confusion. According to the second edition of "Core J2EE Patterns" and contrary to popular belief, stateful session beans are not less scalable than stateless session bean. The reason for that is life cycle of either type is controlled by Application Server and control of life cycle is what defines the scalability of the application
  3. What's the difference between EJB 1.1 and EJB 2.0?
    There are many differences. Some key points you want to mention are:
    1. New CMP model
    2. EJB Query Language
    3. Local interfaces
    4. EJBHome methods
    5. Message Driven Beans (MDB) support
  4. What transaction isolation levels do you know?
    none, repeatable read, read committed, read uncommitted, serializable
  5. What transaction attributes do you know?
    requires new, required, supports, not supported, mandatory, never
  6. What is the difference between optimistic lock and pessimistic lock?
    Optimistic lock is an implicit lock that tries to make best assumption about locking strategy and minimize time spent in lock of resource. Optimistic lock is usually implemented with some kind of timestamp strategy. Pessimistic lock is an explicit lock that set by client.
  7. What are entity beans. Are there any issues with them?
    Typical reaction to this question is very expressive answer that entity beans should not be used. There are many performancy implications with entity beans if used incorrectly. One of the famous problems are "n+1 call problem" Inter-entity bean call is very expensive operation and should be avoided.
  8. What core design patterns do you know?
    Architect must know at least some basic design patters used in J2EE development, e.g. Business Delegate, Session Facade, VO, List Handler, DTO, Composite Entity, etc.
  9. Where business logic should reside?
    Typical answer is "in business tier" This usually opens series of questions like: What is business logic, how to determine business logic, how business logic is different from persistent logic etc.
  10. What is JDO?
    JDO is Java Data Object - persistent framework that is alternative to idea of entity beans
  11. What is the difference between JSP and servlet? When to use what?
    JSP is compiled into servlet. JSP are better suit to view of information, while servlets are better for controlling stuff.
  12. Does the J2EE platform support nested transactions?
    No.
  13. Can you use synchronization primitives in my enterprise beans?
    No.
  14. Why all major application server vendors provide custom class loaders in addition to system jvm class loader?
    System one does not support hot deployment.

Performance questions

  1. What are performance problems in J2EE and how to solve them?
  2. What are Entity beans performance pitfalls?
  3. What performance pattern do you know?

Design Pattern questions

  1. Can you use singleton in EJB?
    Yes, but should not (explain why)
  2. What is MVC pattern and why M, V and C need to be separated?
  3. Describe Business Delegate pattern (or any other pattern)
  4. How to prevent double submission of the form from JSP page? (or describe Synchronizer Token pattern)


Sun River 2009-03-17 11:51 鍙戣〃璇勮
]]>
Interview Questions on UML and Design Patternshttp://www.aygfsteel.com/SunRiver/archive/2009/03/17/260205.htmlSun RiverSun RiverTue, 17 Mar 2009 03:43:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2009/03/17/260205.htmlInterview Questions on UML and Design Patterns

Why to use design patterns?
Give examples of design patterns?
What is UML?
What are advantages of using UML?
What is the need for modelling?
Is it requiste to use UML in software projects?
What are use cases? How did you capture use cases in your project?
Explain the different types of UML diagrams ? sequence diagram , colloboration diagram etc
What is the sequence of UML diagrams in project?
What tools did you use for UML in your project?
What is the difference between activity and sequence diagrams?
What are deployment diagrams?
What are the different object relationships ?
What is the difference between composition and aggregation?
Wheel acting as a part of car ? Is this composition or aggregation?



Sun River 2009-03-17 11:43 鍙戣〃璇勮
]]>
spring涓庤嚜鍔ㄨ皟搴︿換鍔?http://www.aygfsteel.com/SunRiver/archive/2009/03/12/259312.htmlSun RiverSun RiverThu, 12 Mar 2009 04:42:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2009/03/12/259312.htmlspring涓庤嚜鍔ㄨ皟搴︿換鍔?/span>()

闈㈡槸鑷繁鑷姩璋冨害鐨勪竴浜涘涔犮?/span>
榪欓噷鍙噰鐢?/span>jdk鑷甫鐨?/span>timer榪涜鐨勶紝鍑嗗鍦ㄤ笅綃囨枃绔犱腑鐢?/span>Quartz璋冨害鍣ㄣ?/span>
棣栧厛寤虹珛浣犺嚜宸辮榪愯鐨勭被銆?/span>

package com.duduli.li;

public class Display {

    
public void disp(){
        System.out.println("
鑷姩鎺у埗嫻嬭瘯");
    }
}

涓涓畝鍗曠殑java bean錛屽叾涓湪榪欓噷浣犲彲浠ユ浛鎹㈣嚜宸辯殑浠誨姟銆?/span>
鐒跺悗灝辨槸緙栧啓璋冨害紼嬪簭錛岃繖閲岃緇ф壙jdk涓殑TimerTask綾伙紝澶嶅啓浠栫殑run鏂規硶銆?/span>

package com.duduli.li;

import java.util.TimerTask;

public class AutoRan extends TimerTask {
    
//set鏂規硶鏄?/span>spring鐨?/span>DI
    private Display display;
    
    
public void setDisplay(Display display) {
        
this.display = display;
    }
    @Override
    
public void run() {
        display.disp();
    }
}

鐒跺悗灝辨槸閲嶈鐨勪竴姝ワ紝緙栧啓applicationsContext.xml浜嗐?/span>

<?xml version="1.0" encoding="UTF-8"?>
<beans
    
xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation
="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
    
<bean id="display"
        class
="com.duduli.li.Display">
    
</bean>
    
<bean id="atuoRun"
        class
="com.duduli.li.AutoRan">
        
<property name="display" ref="display"></property>
    
</bean>
    
    
<bean id="aR"
    class
="org.springframework.scheduling.timer.ScheduledTimerTask">
        
<property name="timerTask" ref="atuoRun"></property>
<!--
period
澶氶暱鏃墮棿榪愯涓嬈★紝delay琛ㄧず鍏佽浣犲綋浠誨姟絎竴嬈¤繍琛屽墠搴旇絳夊緟澶氫箙
-->

        
<property name="period" value="5000"></property>
        
<property name="delay" value="2000"></property>    
    
</bean>
    
    
<bean id="test"
    class
="org.springframework.scheduling.timer.TimerFactoryBean">
        
<property name="scheduledTimerTasks">
            
<list>
<!--
榪欓噷浣跨敤list錛屽彲浠ヨ皟搴﹀涓?/span>bean錛?/span>
-->

                
<ref bean="aR"/>
            
</list>
        
</property>
    
</bean>
</beans>


鍐嶆潵灝辨槸瀹㈡埛绔皟搴︿簡銆?/span>

package com.duduli.li;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Client {

    
public static void main(String[] args) {
        BeanFactory factory = 
new ClassPathXmlApplicationContext("applicationContext.xml");
        factory.getBean("test");
    }
}

spring涓庤嚜鍔ㄨ皟搴︿換鍔?/span>(浜?/span>)

浣跨敤quartz鍜?/span>spring鑷姩璋冨害銆?/span>
鍏蜂綋瀹炵幇bean錛?/span>

package com.duduli.li.quartz;

import java.util.Date;

public class Display {

    @SuppressWarnings("deprecation")
    
public void disp(){
        System.out.println(
new Date().getSeconds());
        System.out.println("
鑷姩鎺у埗嫻嬭瘯");
    }
}

緇ф壙quartzjobbean綾伙細榪欎釜綾誨拰緇ф壙Timer綾葷被浼?/span>
銆?/span>

package com.duduli.li.quartz;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

public class AutoRun extends QuartzJobBean{

    
private Display  display;
    
    
public void setDisplay(Display display) {
        
this.display = display;
    }

    @Override
    
protected void executeInternal(JobExecutionContext arg0)
            
throws JobExecutionException {
        display.disp();
    }
}

spring閰嶇疆鏂囦歡錛?/span>

                    <!-- quartz榪涜鑷姩璋冨害 -->
<!-- 鍏蜂綋瀹炵幇綾?/span> -->
    
<bean id="display2"    class="com.duduli.li.quartz.Display"></bean>
    
<!-- spring瀵?/span>quartz鐨勬敮鎸侊紝Auto綾誨疄鐜?/span>quartz鐨?/span>job鎺ュ彛鐨勭被錛?/span>jobDataAsMap鏄皢瀹炵幇綾繪敞鍏ュ叾涓?/span> -->
    
<bean id="quartz" class="org.springframework.scheduling.quartz.JobDetailBean">
        
<property name="jobClass" value="com.duduli.li.quartz.AutoRun"/>
        
<property name="jobDataAsMap">
            
<map>
                
<entry key="display" value-ref="display2"></entry>
            
</map>
        
</property>
    
</bean>
    
<!-- spring瀵?/span>quartz鐨勬敮鎸侊紝瀵瑰叾鍊肩殑璁懼畾 -->
    
<bean id="simpleTask" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
        
<property name="jobDetail" ref="quartz"></property>
        
<property name="startDelay" value="2000"></property>
        
<property name="repeatInterval" value="2000"></property>
    
</bean>
    
<!-- 鍚姩鑷姩璋冨害 -->
    
<bean id="quartzTest" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        
<property name="triggers">
            
<list>
                
<ref bean="simpleTask"/>
            
</list>
        
</property>
    
</bean>

client璋冪敤錛?/span>

package com.duduli.li.quartz;


import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Client {

    
public static void main(String[] args) {
            BeanFactory factory = 
new ClassPathXmlApplicationContext("applicationContext.xml");
            factory.getBean("quartzTest");
        }
}



Sun River 2009-03-12 12:42 鍙戣〃璇勮
]]>
Java Interthread communication http://www.aygfsteel.com/SunRiver/archive/2009/03/12/259305.htmlSun RiverSun RiverThu, 12 Mar 2009 04:09:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2009/03/12/259305.htmlJava implements a very efficient interprocess communication which reduces the CPU’s idle time to a very great extent. It is been implemented through wait ( ), notify ( ) and notifyAll ( ) methods. Since these methods are implemented as final methods they are present in all the classes.

The basic functionality of each one of them is as under:


鈻?wait( ) acts as a intimation to the calling thread to give up the monitor and go to sleep until some other thread enters the same monitor and calls notify( ).

鈻?notify( ) is used as intimator to wake up the first thread that called wait( ) on the same object.

鈻?notifyAll( ) as the term states wakes up all the threads that called wait( ) on the same object. The highest priority thread will run first.


public class WaitNotifyAllExample {
 
public static void main(String[] args) {
 
try {
Object o = new Object();
Thread thread1 = new Thread(new MyOwnRunnable("A", o));
Thread thread2 = new Thread(new MyOwnRunnable("B", o));
Thread thread3 = new Thread(new MyOwnRunnable("C", o));
 
// synchronized keyword acquires lock on the object.
synchronized (o) {
thread1.start();
// wait till the first thread completes execution.
// thread should acquire the lock on the object
// before calling wait method on it. Otherwise it will
// throw java.lang.IllegalMonitorStateException 
o.wait();
thread2.start();
// wait till the second thread completes execution
o.wait();
thread3.start();
}
 
}
catch (InterruptedException e) {
e.printStackTrace();
}
 
}
}
 
class MyOwnRunnable implements Runnable {
 
private String threadName;
 
private Object o;
 
public MyOwnRunnable(String name, Object o) {
threadName = name;
this.o = o;
}
 
public void run() {
 
 
synchronized (o) {
for (int i = 0; i < 1000; i++) {
System.out.println("Thread " + threadName + " Count : " + i);
}
// notify all threads waiting for the object o.
// thread should acquire the lock on the object
// before calling notify or notifyAll method on it. 
// Otherwise it will throw java.lang.IllegalMonitorStateException 
o.notifyAll();
}
}
}


Sun River 2009-03-12 12:09 鍙戣〃璇勮
]]>
Creating Array Objects in JavaScript with JSONhttp://www.aygfsteel.com/SunRiver/archive/2009/03/10/258758.htmlSun RiverSun RiverTue, 10 Mar 2009 03:42:00 GMThttp://www.aygfsteel.com/SunRiver/archive/2009/03/10/258758.html闃呰鍏ㄦ枃

Sun River 2009-03-10 11:42 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 高阳县| 韶山市| 双城市| 长海县| 兴和县| 平乡县| 扶余县| 锡林浩特市| 理塘县| 龙门县| 东海县| 大田县| 孝义市| 三穗县| 江陵县| 新竹县| 宜兰县| 南陵县| 无极县| 十堰市| 河北省| 平潭县| 神木县| 泽州县| 浦城县| 广南县| 石楼县| 平潭县| 防城港市| 固原市| 南安市| 巫溪县| 长宁县| 华阴市| 隆德县| 天等县| 宜阳县| 四子王旗| 乌拉特后旗| 静海县| 阿克陶县|