
置頂隨筆
系統架構: webwork+spring+hibernate
?
為了減少數據庫處理壓力,準備對操作進行讀寫分離,但分析了一下,還是準備不做了
Hibernate中起用了延遲加載,所以在web.xml 配置了OpenSessionInviewFiter ,一次 Session操作時不會馬上關閉,但是同一個session中不能出現兩個數據源,讀寫分離失敗.
雖然在spring 配置多例,能處理這個問題,但這樣也帶來了數據庫連接的增多,
現在還想不好怎么來解決這個問題,不知道那位大蝦能幫助一下,謝謝!!!!!!!!!!
posted @
2006-11-21 14:23 野風 閱讀(1069) |
評論 (1) |
編輯 收藏

2007年9月30日
本人學習JAVA差不多3年了吧,回想過去的3年,突然發現自己在技術上沒有特別自豪的東西,JAVA編程思想也改了好幾編,說不上精通但也很熟悉,各個流行框架差不多都用過,說不上精通但也可以熟練用.
性能優化上,也就建索引,用緩存,頁面做靜態化,分庫,讀寫分離.最近學習了一下python,語言特性不是很了解,但也能寫出小功能塊.
JAVA牛人,告訴我,怎么才能讓自己強大起來,回首3年沒有自豪的技術,極度郁悶中
不在沉默中爆發,就在沉默中死亡!!!!!1
posted @
2007-09-30 11:25 野風 閱讀(176) |
評論 (0) |
編輯 收藏

2006年11月21日
系統架構: webwork+spring+hibernate
?
為了減少數據庫處理壓力,準備對操作進行讀寫分離,但分析了一下,還是準備不做了
Hibernate中起用了延遲加載,所以在web.xml 配置了OpenSessionInviewFiter ,一次 Session操作時不會馬上關閉,但是同一個session中不能出現兩個數據源,讀寫分離失敗.
雖然在spring 配置多例,能處理這個問題,但這樣也帶來了數據庫連接的增多,
現在還想不好怎么來解決這個問題,不知道那位大蝦能幫助一下,謝謝!!!!!!!!!!
posted @
2006-11-21 14:23 野風 閱讀(1069) |
評論 (1) |
編輯 收藏

2006年11月17日
關于IBatis緩存使用的一個BUG |
關于IBatis.Net 版本1.321里面的cacheModel有一個BUG,好大的。當你使用CacheModel
而同時查詢出來的結果是NULL的話,IBatis緩存就會有問題。在IBatis.Net 版本1.32里面一共有3處。
MappedStatements 400行處, 527 行 778行
應該改為
?
obj = RunQueryForObject(request, session, parameterObject, resultObject);
?????????????????????????????????? if(obj!=null)
?????????????????????????????????? {
????????????????????????????????????????? _statement.CacheModel[key] = obj;
?????????????????????????????????? }
每一個緩存前,判斷是否為空。
|
posted @
2006-11-17 11:37 野風 閱讀(963) |
評論 (0) |
編輯 收藏

2006年10月31日
public class TestString {
????public TestString() {
????}
????public static void main(String[] args) {
????????String s=new String("Hello");
????????modify(s);
????????System.out.println("s===="+s);
????}
????public static void modify(String s)
????{
????????s+="world";
??????}
}
為什么是輸出Hello,而不是Helloworld??
java里面會對 String ,int ,Integer 等基本類型,會用值進行傳遞,在modify 時會clone拷貝一副本在內存里面,但是打印出來的時候,還是按原來內容
其他Object類型,按照內存地址進行傳遞的,所以在modify 的時候會把值改掉,打印出來也會是“Hello world”
posted @
2006-10-31 16:46 野風 閱讀(279) |
評論 (0) |
編輯 收藏
package com.xiewei.soft.text;
import java.util.TimerTask;
public class HelloWorldTask extends TimerTask{
? public? void? run (){
?? System.out.print("Hello world");
? }
}
package com.xiewei.soft.text;
import java.io.IOException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class Fixed {
? public static void main(String[] arg) throws IOException{
?? ApplicationContext ctx=new FileSystemXmlApplicationContext("JavaSource/conf/timetask.xml");
?? System.in.read();
? }
}
然后在spring配置文件中插入
<beans>
? <bean id ="helloWordTask"? class="com.xiewei.soft.text.HelloWorldTask" />
? <bean id="timerTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
??? <property name="delay">
????? <value>1000</value>
??? </property>
??? <property name="period">
????? <value>3000</value>
??? </property>
??? <property name="timerTask">
????? <ref local="helloWordTask"/>
??? </property>
? </bean>
? <bean id="timerFactory" class="org.springframework.scheduling.timer.TimerFactoryBean">
?? <property name="scheduledTimerTasks">
????? <list>
????? <ref local="timerTask"/>
????? </list>
??? </property>
? </bean>
</beans>
測試成功!!!!!!!
posted @
2006-10-31 15:18 野風 閱讀(1502) |
評論 (1) |
編輯 收藏
/**
?? *
?? * 解析文件,取出URL地址
?? *
?? */
?public static void regexStr(){
??String input="飛機但是??Pattern p = Pattern.compile("http://[*[a-zA-Z]|w{3}].*[a-zA-Z]");
??Matcher m = p.matcher(input);
??m.find();
??String str=m.group();
??????? System.out.print(str);
??
??
?}
/**
?* 根據URL,把網頁保存到本地
?* @param urlStr
?* @param filename
?* @return
?*/?
?public? static? boolean? getUrlToFileInputStream(String urlStr, String filename){
? ?
? ?DataInputStream dataInputStream=null;
? ?try{
? ??? URL url = new URL(urlStr);
?????????? URLConnection conn = url.openConnection();
?????????? dataInputStream = new DataInputStream(conn.getInputStream());
??????????
???? }catch(Exception e){
???? ?e.getMessage();
???
???? }
???? DataOutputStream dataoutputstream = null;
? ?if(dataInputStream !=null){
??? ???? try {
????dataoutputstream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(filename)));
???
???byte b[] = new byte[1024*10];
???int len = 0;
???while ((len = dataInputStream.read(b, 0, 1024)) != -1) {
????dataoutputstream.write(b, 0, len);
???}
???dataoutputstream.flush();
??? ???? } catch (Exception e) {
????// TODO Auto-generated catch block
????e.printStackTrace();
???}
??????????? return true;
? ?}else{
? ??return false;
? ?}
????
????
? }
posted @
2006-10-31 15:06 野風 閱讀(1264) |
評論 (1) |
編輯 收藏