TMD 到底什么是異常
程序按照預(yù)期的流程運行..正常態(tài)
出現(xiàn)未預(yù)計到的情況..比如網(wǎng)線斷了gddg...文件打開失敗...
這個時候 程序是繼續(xù)執(zhí)行 還是 其他的選擇 或者 退出app ....
實際的情況是 有可能可以恢復(fù),從業(yè)務(wù)角度出發(fā)..我可以重新試圖連接...可以重新打開文件或者換一個文件 或者重新創(chuàng)建一個新的文件....
只要不是致命的問題..通常是可以恢復(fù)的...沒必要退出app...
如果你不捕獲 網(wǎng)絡(luò)斷開或者文件無法打開的 異常 ...那么為什么程序退出了呢...因為你沒有告訴你的程序 如果出錯了應(yīng)該怎么辦...sun 規(guī)避風(fēng)險,你出錯了,可能下一步要錯誤的扣除你工資,為了解除這種不確定執(zhí)行的巨大風(fēng)險...那么就把你app shutdown了....
如果你有catch 對于程序來說 你有防備 出現(xiàn)異常的準(zhǔn)備...那么真到了異常 那么就看你異常的處理流程 是否奏效....
異常體系....瞎扯淡...就是幾個異常類的繼承關(guān)系(虛擬機內(nèi)部異常,用戶定義異常 ...).....還能有什么 .
無非是 根據(jù)不同的出錯類型來 包裝異常...給這個這種類型的異常 或者 這類問題取一個名字....
當(dāng)你沒看堆棧信息的時候大概可以 判斷一下 問題再那里而已.....
異常來跳轉(zhuǎn) 程序是因為 無法預(yù)期異常后下步該如何執(zhí)行 所以跳轉(zhuǎn)...
異常是比較消耗系統(tǒng)資源的.
.net 為什么沒有主動要求你 拋出異常....
因為.net的主要架構(gòu)師 再設(shè)計.net時候看到了 很多程序員 一層一層的拋出異常只在最底層 main中截獲異常....
那么大量的函數(shù)都是 throws 其實根本無意義....所以他再設(shè)計的時候就沒有采取和java 相同的方式 .
片段 "
public LocationInfo(Type callerStackBoundaryDeclaringType)
{
// Initialize all fields
m_className = NA;
m_fileName = NA;
m_lineNumber = NA;
m_methodName = NA;
m_fullInfo = NA;
#if !NETCF
if (callerStackBoundaryDeclaringType != null)
{
try
{
StackTrace st = new StackTrace(true);
int frameIndex = 0;
// skip frames not from fqnOfCallingClass
while (frameIndex < st.FrameCount)
{
StackFrame frame = st.GetFrame(frameIndex);
if (frame != null && frame.GetMethod().DeclaringType == callerStackBoundaryDeclaringType)
{
break;
}
frameIndex++;
}
// skip frames from fqnOfCallingClass
while (frameIndex < st.FrameCount)
{
StackFrame frame = st.GetFrame(frameIndex);
if (frame != null && frame.GetMethod().DeclaringType != callerStackBoundaryDeclaringType)
{
break;
}
frameIndex++;
}
if (frameIndex < st.FrameCount)
{
// now frameIndex is the first 'user' caller frame
StackFrame locationFrame = st.GetFrame(frameIndex);
if (locationFrame != null)
{
System.Reflection.MethodBase method = locationFrame.GetMethod();
if (method != null)
{
m_methodName = method.Name;
if (method.DeclaringType != null)
{
m_className = method.DeclaringType.FullName;
}
}
m_fileName = locationFrame.GetFileName();
m_lineNumber = locationFrame.GetFileLineNumber().ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
// Combine all location info
m_fullInfo = m_className + '.' + m_methodName + '(' + m_fileName + ':' + m_lineNumber + ')';
}
}
}
catch(System.Security.SecurityException)
{
// This security exception will occur if the caller does not have
// some undefined set of SecurityPermission flags.
LogLog.Debug("LocationInfo: Security exception while trying to get caller stack frame. Error Ignored. Location Information Not Available.");
}
}
#endif
}
C# Preprocessor Directives
時間
select
trunc(86400*
(to_date('2009-1-1 23:15:01','yyyy-mm-dd hh24:mi:ss') -
to_date('2009-1-1 23:10:00','yyyy-mm-dd hh24:mi:ss'))
)
from dual ;
在啟動時關(guān)閉sendmail 服務(wù) [其它服務(wù)也一樣]
posted by JianNeng in Opensource 在啟動時關(guān)閉sendmail- -
對其他的服務(wù)可以采取同樣的措施。
而對于那些不是從inetd啟動的服務(wù),則通過命令來關(guān)閉,例如需要關(guān)閉sendmail服務(wù),則:
/etc/rc.d/init.d/sendmail stop
然后再設(shè)置其不在系統(tǒng)啟動時啟動:
chkconfig -levels 12345 sendmail off
[root@oracle xinetd.d]# chkconfig --level 123456 sendmail off
[root@oracle xinetd.d]#
linux 關(guān)機
[root@oracle ~]# shutdown -h now
摘要: plsql developer plsql 調(diào)試無法 ..包沒加入所有的函數(shù)的定義到 包頭文件定義.
閱讀全文
摘要: 為什么log4j 顯示行號
(2) 建立一個Throwable的對象來取得當(dāng)前運行堆棧的快照...Throwable.fillInStackTrace();
(3) 從拋出的Throwable對象中,來分析出當(dāng)前l(fā)og信息的行號...
閱讀全文
摘要: 其實,很簡單,并不是因為系統(tǒng)打了補丁的問題,而是因為VS 2008打了補丁,導(dǎo)致沒法刪除,可以在“添加/刪除程序”面板中,選中上方的“顯示更新”,然后找到VS 2008,下面多多少少會掛了幾個更新或者補丁,全部先刪掉,然后再刪VS 2008,熟悉的維護界面又回來了,輸入序列號,OK,正常使用~~~
閱讀全文
摘要: lsnrctl services
閱讀全文
摘要: sqlplus Xdmp/Xdmp@127.0.0.1:1521/Xdmp
SQL> conn sys/oracle @itmp_rac as sysdba
閱讀全文
摘要: 左連接 .如果一邊的沒有記錄, nvl (右邊,0) 否則會造成整列無法,無數(shù)據(jù).
select d.crunit_ - nvl( a.stkamt_ ,0)
from dl_fundetf d ,
(select c.stkcode_, c.exchgcode_,c.stkamt_ ,c.stkcost_
from acc_proflstk c
where 1=1
and c.fundid_ = '55'
and c.cellid_ = '50001'
and c.proflid_ = '080724113732'
) a
where 1=1
and d.exchgcode_ = 'SH'
and d.fundid_ = '510051'
and a.exchgcode_ (+)= d.exchgcode_
and a.stkcode_ (+)= d.fundid_
閱讀全文
摘要: 1.作用: 屏蔽方法名 ,靈活性動態(tài)性函數(shù)指針
2 .使用:
定義一個委托: 和一個類一樣的
delegatevoid Del (int x);
或者
delegatevoid Del
(T x);
定一個委托變量和賦值
Main(){
Del d = obj.DoWork; 實例方法或者靜態(tài)方法都可以
}
閱讀全文
摘要: 檢查客戶機器上的輸入法區(qū)域設(shè)置。如果默認輸入法不是中文,則先調(diào)用一下方法,切換到中文。
Top
閱讀全文