Single instance of an object
Hi,
If wereally want to have one and only one instance of the class we need to do two things.
1. Make the constructor(s) of that class private.
2. Now to create an instance of that class we need to have a public static method in that class. Also take a reffernce variable of the same class.
This method say getInstance() will check the above said reffernce variable and if found null, call the private constructor and assign the object to the reffernce variable. this method then return the instance. If it find the reffernce variable to be not null Then it just return the old object.
Is it thread safe by doing like this. If one thread has created the object of the class and then if that thread is suddenly interupted, then will the second thread create the new object of that class or it picks up the previously created instance only?
Not especially. This is a case where making the thing thread-safe is actually the easier option, anyway. Let the runtime do the heavy lifting
class MySingleton {
public static final MySingleton INSTANCE = new MySingleton(); // the JVM will lazily load this for you
private MySingleton() {}There. The runtime will ensure that only one instance (per classloader) will exist
Similar Messages
-
Hi,
We are in the process of consolidating several databases on a single instance of SQL Server 2012.
Databases are developed by outside vendors; they have to be able to install and support their databases but they shouldn't be able to do any thing with the other databases.
When I tried to migrate the first database, the vendor told me that on the former server he used the sa account in some batch.
On a previous thread
https://social.technet.microsoft.com/Forums/sqlserver/en-US/dc1f802f-d8de-4e2b-87e5-ccb289593fb7/security-for-multiple-applications-on-a-single-sql-server-2012-instance?forum=sqlsecurity
it was suggested to me that I create a login for each vendor and that this login should map a user in their respective databases.
To test, I simulated the process in a test database:
1 - I create the login and I scripted the command:
USE [master]
GO
/* For security reasons the login is created disabled and with a random password. */
/****** Object: Login [M02_Test] Script Date: 2014-12-02 16:23:58 ******/
CREATE LOGIN [M02_Test] WITH PASSWORD=N'ÈS^y¡¶=Å€"+y¤j|úªhÖféÎЕœEu
c', DEFAULT_DATABASE=[M02], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
ALTER LOGIN [M02_Test] DISABLE
GO
2 - I create the user and scripted it
USE [M02]
GO
/****** Object: User [M02_Test] Script Date: 2014-12-02 16:29:41 ******/
CREATE USER [M02_Test] FOR LOGIN [M02_Test] WITH DEFAULT_SCHEMA=[dbo]
GO
Questions:
What should we do with te scrambled password: is it saved as it was entered and should it be kept somewhere in a safe place?
Would that do the job for the vendor who used sa before?
Thanks for your adviceI'm not sure why you would save the script. Why not create the login, in one way or another give the vendor the password. Keep the login disabled until needed.
I don't recall exactly what we said last time, but it occurs to me that the application setup things on server level. Jobs is the prime thing that comes to mind, but there could be other things.
Now, here is an important observation. As long as the vendor's application was alone on the server, that was OK, and it was OK to give the vendor sysadmin rights. In this situation this is less OK, and as we said, you should only give the vendor db_owner
in the database.
But the vendor will need to tell you what they do on server-level. They should know this - unless they sell their app as a "alone-on-a-server application". (And there are indeed such applications out there, even from Microsoft.) But there is a
risk that they will bill you extra if you make their installation more difficult.
Maybe you will have to give some vendors sysadmin for the installation, but in such case, you should ask them why they need it. If they don't, give them db_owner, and they will have to find out their hard way. (And you don't pay them for learning
their own application.)
Erland Sommarskog, SQL Server MVP, [email protected] -
The Unifier environment
contains two single-instance project shells, INF and PBS, and two multiple-instance child project shells, INFS and
PB. There is a single instance, non-workflow
business process, ‘Project Information’ that contains a data element in the
upper form definition, Project ID. The Project ID is set to auto-populate from the multi-instance “INFS”
project shell attribute, which is populated manually.
Issue: The auto-populate functionality for the
Project ID ‘Shell_shellName_shell’ data element within the single-instance
Project Information BP only functions within one of the shells, either
INFS or PB, but not both. The INF and INFS shells are currently deployed
to production, PB and PBS shell are not.
It is critical that Project ID ‘Shell_shellname_shell’ data element is populated correctly in the
Project Information upper form of both shells, INFS and PB,
because that data element is referenced by multiple business processes and
integrations.
The attribute form definitions for both single and multiple instance project shells are identical. The Project ID utilizes the same data
element ‘SHELL_shellName_shell’ as is defined in both shell attribute forms
(INFS and PB).
The data definition source is a Unifier system-level variable, SYS Shell
Name (String, 128, Text Box)
Potential Solutions:
1. Create a Project ID DE of another data type which can
be successfully auto-populated from either shell. Drawback: all BPs and integrations which
reference Shell_Shellname_shell will need to be rewritten.
2. Investigate converting the Project Information single-instance
to a multi-instance BP, and create a
separate instance for each single-instance shell type. Same Drawback as Option #1, but with additional
rework. Most likely Project Information
would have to be recreated as a new BP.
Not sure that this option would even work.
3. Create a separate Project Information BP for PB. Drawback: Two separate BPs for Project Information would
need to be created. All existing BPs
refer to Project Information, so this option could potentially invalidate the
ability to use the existing BPs in the PB shell.Was it really necessary to post the whole API description?!?
Locale[] locales = Locale.ENGLISH();ENGLISH is not a method in class Locale, so do not add the braces "( );".
Also, the constant ENGLISH is not an array, but just a single Locale object.
You didn't say what your problem was. What do you want to achieve with your program and what is it that you don't understand? -
How do i create a single instance of a class inside a servlet ?
how do i create a single instance of a class inside a servlet ?
public void doGet(HttpServletRequest request,HttpServletResponseresponse) throws ServletException, IOException {
// call a class here. this class should create only single instance, //though we know servlet are multithreaded. if, at any time 10 user comes //and access this servlet still there would one and only one instance of //that class.
How do i make my class ? class is supposed to write some info to text file.i have a class MyClass. this class creates a thread.
i just want to run MyClass only once in my servlet. i am afriad, if there are 10 users access this servlet ,then 10 Myclass instance wouldbe created. i just want to avoid this. i want to make only one instance of this class.
How do i do ?
they have this code in the link you provided.
public class SingletonObject
private SingletonObject()
// no code req'd
public static SingletonObject getSingletonObject()
if (ref == null)
// it's ok, we can call this constructor
ref = new SingletonObject();
return ref;
public Object clone()
throws CloneNotSupportedException
throw new CloneNotSupportedException();
// that'll teach 'em
private static SingletonObject ref;
}i see, they are using clone !, i dont need this. do i ? shouldi delete that method ?
where do i put my thread's run method in this snippet ? -
SQL 2012 install fails with 'Object reference not set to an instance of an object.'
Hi, I'm trying to install SQL 2012 RTM Enterprise on a Windows 2008 R2 single node cluster.
The installer starts goes through some checks and then fails with the message 'Object reference not set to an instance of an object.' It happens while the small 'wait while...' dialog box is
showing, another window pops up briefly (I think the feature selection window - can't really tell as it doesn't draw before disappearing). Then the ‘Object reference not set’ message comes up.
From the summary log file..
Overall summary:
Final result:
Failed: see details below
Exit code (Decimal):
-2147467261
Exit facility code:
0
Exit error code:
16387
Exit message:
Object reference not set to an instance of an object.
Start time:
2012-09-26 08:52:53
End time:
2012-09-26 08:54:08
Requested action:
InstallFailoverCluster
Exception help link:
http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.2100.60&EvtType=0x9AF1AE5E%400x44A889F9&EvtType=0x9AF1AE5E%400x44A889F9
Exception summary:
The following is an exception stack listing the exceptions in outermost to innermost order
Inner exceptions are being indented
Exception type: System.NullReferenceException
Message:
Object reference not set to an instance of an object.
Data:
HelpLink.EvtType = 0x9AF1AE5E@0x44A889F9
DisableWatson = true
Stack:
at Microsoft.SqlServer.Configuration.RulesEngineExtension.RulesEngine.ShouldRuleRun(Rule rule)
at Microsoft.SqlServer.Configuration.RulesEngineExtension.RulesEngine.IsRuleSkipped(Rule rule)
at Microsoft.SqlServer.Configuration.RulesEngineExtension.RulesEngine.LoadRule(String ruleId, List`1 ruleProperties, XmlSchema ruleSchema, XmlElementParserFactory elementParser)
at Microsoft.SqlServer.Configuration.RulesEngineExtension.RulesEngine.LoadRules(IEnumerable`1 ruleIds)
at Microsoft.SqlServer.Configuration.InstallWizard.RunRuleProgressController.Initialize()
I have rebooted, tried different media, tried uninstalling the setup files and rerunning but always get the same result.
Any help would be gratefully accepted.
Thanks,
Bruce.Hi Alberto,
Whenever I am trying to install SQL 2012 with SP1 clustering, I am getting below error. Can you please advise on this.
Additional information are
Windows Servers Version and Edition - Windows 2012 Strandedition
SQL Server Version and Edition - SQL 2012 with SP1
All the machines are running on Hyper-V and Passed the cluster validation test successfully. there is no issue. The servers' (Nodes) names are;
DomainServerName - ACONDomainGroup (1gb ram allocated)
Node1 - AconNODE1W2K12STD (2.5gb ram allocated )
Node2 - AconNODE2W2K12STD (1.5 ram allocated allocated)
WindowsClusterName - AconWinCLTR
Below is Summary.txt Error
Update Source: MU
User Input Settings:
ACTION: InstallFailoverCluster
AGTDOMAINGROUP: <empty>
AGTSVCACCOUNT: <empty>
AGTSVCPASSWORD: <empty>
ASBACKUPDIR: Backup
ASCOLLATION: Latin1_General_CI_AS
ASCONFIGDIR: Config
ASDATADIR: Data
ASLOGDIR: Log
ASPROVIDERMSOLAP: 1
ASSERVERMODE: MULTIDIMENSIONAL
ASSVCACCOUNT: <empty>
ASSVCPASSWORD: <empty>
ASSVCSTARTUPTYPE: Automatic
ASSYSADMINACCOUNTS: <empty>
ASTEMPDIR: Temp
COMMFABRICENCRYPTION: 0
COMMFABRICNETWORKLEVEL: 0
COMMFABRICPORT: 0
CONFIGURATIONFILE:
ENU: true
ERRORREPORTING: false
FAILOVERCLUSTERDISKS: <empty>
FAILOVERCLUSTERGROUP:
FAILOVERCLUSTERIPADDRESSES: <empty>
FAILOVERCLUSTERNETWORKNAME: <empty>
FEATURES:
FILESTREAMLEVEL: 0
FILESTREAMSHARENAME: <empty>
FTSVCACCOUNT: <empty>
FTSVCPASSWORD: <empty>
HELP: false
IACCEPTSQLSERVERLICENSETERMS: false
INDICATEPROGRESS: false
INSTALLSHAREDDIR: C:\Program Files\Microsoft SQL Server\
INSTALLSHAREDWOWDIR: C:\Program Files (x86)\Microsoft SQL Server\
INSTALLSQLDATADIR: <empty>
INSTANCEDIR: C:\Program Files\Microsoft SQL Server\
INSTANCEID: <empty>
INSTANCENAME: <empty>
ISSVCACCOUNT: NT AUTHORITY\Network Service
ISSVCPASSWORD: <empty>
ISSVCSTARTUPTYPE: Automatic
MATRIXCMBRICKCOMMPORT: 0
MATRIXCMSERVERNAME: <empty>
MATRIXNAME: <empty>
PID: *****
QUIET: false
QUIETSIMPLE: false
RSINSTALLMODE: DefaultNativeMode
RSSHPINSTALLMODE: DefaultSharePointMode
RSSVCACCOUNT: <empty>
RSSVCPASSWORD: <empty>
RSSVCSTARTUPTYPE: Automatic
SAPWD: <empty>
SECURITYMODE: <empty>
SQLBACKUPDIR: <empty>
SQLCOLLATION: SQL_Latin1_General_CP1_CI_AS
SQLSVCACCOUNT: <empty>
SQLSVCPASSWORD: <empty>
SQLSYSADMINACCOUNTS: <empty>
SQLTEMPDBDIR: <empty>
SQLTEMPDBLOGDIR: <empty>
SQLUSERDBDIR: <empty>
SQLUSERDBLOGDIR: <empty>
SQMREPORTING: false
UIMODE: Normal
UpdateEnabled: true
UpdateSource: MU
X86: false
Configuration file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20140420_052344\ConfigurationFile.ini
Rules with failures:
Global rules:
There are no scenario-specific rules.
Rules report file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20140420_052344\SystemConfigurationCheck_Report.htm
Exception summary:
The following is an exception stack listing the exceptions in outermost to innermost order
Inner exceptions are being indented
Exception type: System.NullReferenceException
Message:
Object reference not set to an instance of an object.
HResult : 0x80004003
Data:
HelpLink.EvtType = 0x9AF1AE5E@0x44A889F9
DisableWatson = true
Stack:
at Microsoft.SqlServer.Configuration.RulesEngineExtension.RulesEngine.ShouldRuleRun(Rule rule)
at Microsoft.SqlServer.Configuration.RulesEngineExtension.RulesEngine.IsRuleSkipped(Rule rule)
at Microsoft.SqlServer.Configuration.RulesEngineExtension.RulesEngine.LoadRule(String ruleId, List`1 ruleProperties, XmlSchema ruleSchema, XmlElementParserFactory elementParser)
at Microsoft.SqlServer.Configuration.RulesEngineExtension.RulesEngine.LoadRules(IEnumerable`1 ruleIds)
at Microsoft.SqlServer.Configuration.InstallWizard.RunRuleProgressController.Initialize() -
Siebel Instance Strategy – Single Instance or Multiple Instances – Advantag
Folks,
We are looking for any white papers on Siebel Instance Strategies. We currently have 5 Siebel individual instances deployed over last 10 years for different business.
Is it a good idea to merge all these instances into one?
May be merge to say 3 instances depending on the objects we are using?
What are the challenges, organization structure, field extensions, column extensions, workflows, what should be looking at?
To answer these questions are there any white papers? Any documentation on how to merge two or more production instances?
Any input / pointers would be appreciated.
Thanks.user10751811 wrote:
how do I find out if my db is running a single instance or multiple instance. I got oracle9i. thanks in advance.Db, on one single machine doesn't run with multiple instances. On a machine,there would be a single instance that would be running. What's important to know that whether its possible for your db to run multiple instances for it or not? For this, you can check the value of the parameter cluster_database is true or not? If its true, your db is RAC eabled and can use multiple instances. If false, you would have a 1:1 mapping of database and instance.
HTH
Aman.... -
Capturing a single Instance of a RT signal
Hello,
I've been looking through and through to find a simple way to capture a single instance of an analog input signal and store it as a constant. To be specific I want to take the very first value an analog signal outputs upon running the program and store it as a constant to be used elsewhere.
Thank you for any help the forum community might be able to provide.
Solved!
Go to Solution.There isn't nearly enough information in your post to even begin giving an intelligent answer. More information? Do you have any code written yet?
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
I am running a custom workflow to create volumes that has worked since WFA 2.x, and which works well in 3.0P1. With WFA 3.1RC1 it throws this error when attempting to apply a quota to the volume: INFO [Apply Quota Policy to Volume or Qtree] Started Quota resize on volume post_wfa31rc1_test2_w_mirror on vserver MySVM ERROR [Apply Quota Policy to Volume or Qtree] Command failed for Workflow 'Create Volume (Schwab)' with error : Object reference not set to an instance of an object. INFO [Apply Quota Policy to Volume or Qtree] ***** Workflow Execution Failed ***** I have executed the PS commands from this code block in a PS shell with no errors. Has anyone else seen a similar issue with 3.1RC1? Scott Lindley
I have narrowed the problem down to a single command and can reproduce the problem very easily. However, I can't seem to fix it. But I believe importing this single custom command into both a WFA 3.0P1 and WFA 3.1RC1 system will easily show that it works in 3.0P1 and throws the odd 'Object reference not set to an insance of an object' error. I say that is an odd error because I'm only used to seeing that error at Preview time referring to an object reference in a Command Parameter field of a workflow. I know how to deal with that issue. However here, the error appears at the end a PowerShell command. Actually, the PowerShell command appears to me to execute entirely and correctly. It is just that at the end of running this exception error is thrown and that causes the command (and workflow if running within a workflow) to fail. But the comamnd correctly adds the 'default' quota policy to the volume and even enables quota resize as it should. So it works, but still blows up the workflow it is within. I'm going to attempt to attach these three things here: 1) screenshot showing the command running (with Command Test Button) fine under WFA-3.0P1, 2) a screenshot showing the command running but throwing the error on a WFA-3.1RC1 system 3) the ,dar file holding just the command: "Apply Quota Policy to Volume or Qtree" (I added .txt to the end of .dar file name) ------1) running OKay on 3.0P1 -------------------------- 2) running with the ERROR on WFA 3.1RC1 SOME NOTES: My lab environment where I re-created the problem: The WFA 3.0P1 system is a Windows 2008R2 server that happens to have the original PowerShell 2.0 on it The WFA 3.1RC1 system is a Windows 7 system that I have updated PowerShell to 4.0. The customer environment: I'm less certain of details (maybe Scott can fill in) The version of PowerShell is TBD (guessing 2.0) , but they are running the same PS version for both 3.0P1 and 3.1RC1 because they are upgrading/downgrading WFA on the same system
-
New instances of an object with a button - please help
Hi
Hope anyone can help with a simple sample/solution.
Think i seach the entire world !!!
Want to make fx. 40 instances of an object ( chosen by user ) - in the "old Flash" there was eval();
- as i remember I could create multiple instances of an object like this:
int numberOfBikes = 40;
for (i = 0;i < numberOfBikes;i++){
newInstanceName = eval("bike"+i) ; // this is my only problem in the world - for now :o(
Bike newInstanceName = new Bike() ; // newInstanceName translated to example "bike12"
newInstanceName.moveTheBike(some arguments) ;
// YEAH - then I had 40 different bikes
Please - if anyone have a simple solution for that single line of code - 500 lines of complex array coding does not help a newborn !!!You are at once on my Buddy list :o)
Now i have 40 bikes running all over town - looks pretty cool
This worked in my run method:
int i;
int numberOfBikes = 40;
test bikes[] = new test[numberOfBikes];
for (i = 0;i < numberOfBikes;i++)
bikes[i] = new test();
}This code in my while loop to call the Class method:
for (i = 0;i < numberOfBikes;i++)
bikes.goAhead(gcon, H, V);
Cool - was a MEGA help !!! -
Error initiating process in single instance mode
We have implemented Guided Procedures and have included a visual approval step to review an employee's supporting documentation before an Admin makes changes based on the approval request, and also KM documentation steps and iViews. Lately in the Alerts monitoring area I am seeing multiple errors.
I have checked the callable objects and all pass the check (including input and output parameters, results states, process exceptions and configuration parameters) however the error keeps showing up. Within the process instatiation tab the process is set to 'single running process is permitted for each user'.
Does anyone know what may be causing these alerts, and how do you repair them?
The full alert is below:
Error initiating process in single instance mode
com.sap.caf.eu.gp.model.pfw.core.SingleInstanceProcessException: Error initiating process in single instance mode
at com.sap.caf.eu.gp.model.pfw.core.impl.ProcessRuntime.startProcess(ProcessRuntime.java:1049)
at com.sap.caf.eu.gp.ui.inst.CInstantiation.initiateProcess(CInstantiation.java:533)
at com.sap.caf.eu.gp.ui.inst.wdp.InternalCInstantiation.initiateProcess(InternalCInstantiation.java:199)
at com.sap.caf.eu.gp.ui.inst.VData.onPlugFromWizard(VData.java:174)
at com.sap.caf.eu.gp.ui.inst.wdp.InternalVData.wdInvokeEventHandler(InternalVData.java:166)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.navigate(ClientApplication.java:826)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.navigate(ClientComponent.java:881)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doNavigation(WindowPhaseModel.java:498)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:144)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:333)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:761)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:696)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:253)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:73)
at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.sendDataAndProcessActionInternal(AbstractApplicationProxy.java:869)
at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.create(AbstractApplicationProxy.java:229)
at com.sap.portal.pb.PageBuilder.updateApplications(PageBuilder.java:1346)
at com.sap.portal.pb.PageBuilder.createPage(PageBuilder.java:356)
at com.sap.portal.pb.PageBuilder.init(PageBuilder.java:549)
at com.sap.portal.pb.PageBuilder.wdDoRefresh(PageBuilder.java:595)
at com.sap.portal.pb.PageBuilder$1.doPhase(PageBuilder.java:867)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processPhaseListener(WindowPhaseModel.java:755)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doPortalDispatch(WindowPhaseModel.java:717)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:136)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:333)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:712)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:253)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)Hello,
The GP SingleInstanceProcessException is normal when using
Single instance process instances which for example ESS uses.
If you have single instance processes and you try to start an already
started instance, the exception will appear but will not cause problems.
It notifies the UI to redirect to the previous process instance.
It is expected behaviour.
Thanks and best regards,
Carl Connolly
Senior Support Consultant - Netweaver Web Application Server
AGS Primary Support, Global Support Centre Ireland
Guided Procedures trouble shooting guide:
https://
www.sdn.sap.com/irj/scn/wiki?path=/display/jstsg/%2528gp%2529home -
Managing Multiple threads accessing a single instance of a class
Hi,
i have to redesign a class, say X, in such a way that i manage multiple threads accessing a single instance of the class, we cannot create multiple instances of X. The class looks like this:
Class X{
boolean isACalled=false;
boolean isInitCalled=false;
boolean isBCalled=false;
A(){
isACalled=true;
Init(){
if(!isACalled)
A();
B();
C();
isInitCalled=true;
B(){
if(!isACalled)
A();
isBCalled=true;
C(){
if(!isACalled)
A();
if(!isBCalled)
B();
}//end of class
Init is the method that would be invoked on the single instance of this class.
Now i cannot keep the flags as instance variables coz different threads would have differrent status of these flags at the same time, hence i can make them local, but if i make them local to one method, the others won't be able to check their status, so the only solution i can think of is to place all the flags in a hashtable local to method INIT AND INITIALIZE ALL OF them to false, as init would call other methods, it would pass the hashtable reference as an additional parameter, the methods would set the flags in the hashtable and it would be reflectecd in the original hashtable, and so all the methods can have access to the hashtable of flags and can perform their respective checks and setting of flags.
This all would be local to one thread, so there's no question of flags of one thread mixin with the flags of some other thread.
My question is :
Is this the best way, would this work?
In java, everything is pass by value, but if i pass the hashtable reference, would the changes made inside the called method to the hashtable key-value would be visible in the original hashtable declared inside the calling method of which the hashtable is local variable?In Java object variables are passed "by copy of reference", and primitive variables "by value".
The solution with HashMap/Hashtable you suggest is ok, but I think you should read about ThreadLocal class:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadLocal.html -
Just a SINGLE instance of a class
Hai !!!
Kindly take a look at the psuedocode below and tell me if this would create just a "single" instance of class A through out my application.
I have 3 classes A, B, C.
class B {
private A a1 = null;
public C method1 () {
getA();
//System.out.println (a1.toString());
return new C(a1);
private A getA() {
if (a1 == null) a1 = new A();
return a1;
} // end class BI used "System.out.println" to check if I got the same instance of class A. Is this correct?
Note: I got the same a1.toString() printed for different clients. Is this the way to check?
ThanksThanks to all of you. I am new to this kind of
programming. So having some difficulties.
In my program, no matter what, only one instance of
'B' is going to be used. It's like this: B b = new
B(); and this 'b' is used throughout. Or I can say 'b'
is a server object and all clients are going to look
up to only one 'b'. So is it enough to have just this
line of code inside the constructor of B : a1 = new
A();
Since there's going to be just one 'b', can I assume
there's going to be only "one" a1??
I feel I needn't even go into getData().
public class B {
A a1;
public B() {
a1 = new A();
public C method1() {
return new C(a1);
}The clients would be using 'b'(a single instance of B)
to access method1. So all the clients are going to get
the same a1. Am I right?
Thanks again !!!True, unless someone desides to use your code and makes a second B, or you do some manipulation later on and you end up making a new B. Then there are two As floating around and two Bs floating around, and you may not know it till some strange behavior occurs... -
How can I store a single instance of a hashtable
How can I store a single instance of a hashtable in a predefined application object that way I can use it by all sessions? I've tried storing a instance of hashtable in the session but it only allows for one user and it doesn't accomplish my goal in the web application. Could show me how i could store a single instance of a hashtable in a predefined application object? Or at least a link which demonstrates it
thanksassuming ctx is an instance of javax.servlet.ServletContext (which can be retrieved from the ServletConfig).
ctx.setAttribute("yourAttrName", new Hashtable()); -
Streams Setup from RAC to Single instance
Does anyone have a document to setup streams from RAC to Non RAC. I successfully setup streams on 2 single instances but I am having issues in replicating, Streams is setup on node1 or Rac and Apply process is also setup on single node. but data is not replicating.
Appreciate any suggestions.From Metalink Note 418755.1:
Additional Configuration for RAC Environments for a Source Database Archive Logs
The archive log threads from all instances must be available to any instance
running a capture process. This is true for both local and downstream capture.
Queue Ownership
When Streams is configured in a RAC environment, each queue table has an
"owning" instance. All queues within an individual queue table are owned by
the same instance. The Streams components (capture/propagation/apply) all
use that same owning instance to perform their work. This means that
+ a capture process is run at the owning instance of the source queue.
+ a propagation job must run at the owning instance of the queue
+ a propagation job must connect to the owning instance of the target queue.
Ownership of the queue can be configured to remain on a specific instance,
as long as that instance is available, by setting the PRIMARY _INSTANCE
and/or SECONDARY_INSTANCE parameters of DBMS_AQADM.ALTER_QUEUE_TABLE.
If the primary_instance is set to a specific instance (ie, not 0), the queue
ownership will return to the specified instance whenever the instance is up.
Capture will automatically follow the ownership of the queue.If the ownership
changes while capture is running, capture will stop on the current instance
and restart at the new owner instance.
For queues created with Oracle Database 10g Release 2, a service will be
created with the service name= schema.queue and the network name
SYS$schema.queue.global_name for that queue. If the global_name of the
database does not match the db_name.db_domain name of the database, be sure
to include the global_name as a service name in the init.ora.
For propagations created with the Oracle Database 10g Release 2 code with
the queue_to_queue parameter to TRUE, the propagation job will deliver only
to the specific queue identified. Also, the source dblink for the target
database connect descriptor must specify the correct service (global name of
the target database ) to connect to the target database. For example, the
tnsnames.ora entry for the target database should include the CONNECT_DATA
clause in the connect descriptor for the target database. This claus should
specify (CONNECT_DATA=(SERVICE_NAME='global_name of target database')).
Do NOT include a specific INSTANCE in the CONNECT_DATA clause.
For example, consider the tnsnames.ora file for a database with the global name
db.mycompany.com. Assume that the alias name for the first instance is db1 and
that the alias for the second instance is db2. The tnsnames.ora file for this
database might include the following entries:
db.mycompany.com=
(description=
(load_balance=on)
(address=(protocol=tcp)(host=node1-vip)(port=1521))
(address=(protocol=tcp)(host=node2-vip)(port=1521))
(connect_data=
(service_name=db.mycompany.com)))
db1.mycompany.com=
(description=
(address=(protocol=tcp)(host=node1-vip)(port=1521))
(connect_data=
(service_name=db.mycompany.com)
(instance_name=db1)))
db2.mycompany.com=
(description=
(address=(protocol=tcp)(host=node2-vip)(port=1521))
(connect_data=
(service_name=db.mycompany.com)
(instance_name=db2)))
Use the italicized tnsnames.ora alias in the target database link USING clause.
DBA_SERVICES lists all services for the database. GV$ACTIVE_SERVICES identifies
all active services for the database In non_RAC configurations, the service
name will typically be the global_name. However, it is possible for users to
manually create alternative services and use them in the TNS connect_data
specification . For RAC configurations, the service will appear in these views
as SYS$schema.queue.global_name.
Propagation Restart
Use the procedures START_PROPAGATION and STOP_PROPAGATION from
DBMS_PROPAGATION_ADM to enable and disable the propagation schedule.
These procedures automatically handle queue_to_queue propagation.
Example:
exec DBMS_PROPAGATION_ADM.stop_propagation('name_of_propagation'); or
exec DBMS_PROPAGATION_ADM.stop_propagation('name_of_propagation',force=>true);
exec DBMS_PROPAGATION_ADM.start_propagation('name_of_propagation');
If you use the lower level DBMS_AQADM procedures to manage the propagation schedule,
be sure to explicitly specify the destination_queue name when queue_to_queue propagation has been configured.
Example:
DBMS_AQADM.UNSCHEDULE_PROPAGATION('source_queue_name','destination',destination_queue=>'specific_queue');
DBMS_AQADM.SCHEDULE_PROPAGATION('source_queue_name','destination',destination_queue=>'specific_queue');, DBMS_AQADM.ENABLE_PROPAGATION_SCHEDULE('source_queue_name','destination',destination_queue=>'specific_queue');,
DBMS_AQADM.DISABLE_PROPAGATION_SCHEDULE('source_queue_name','destination',destination_queue=>'specific_queue');, DBMS_AQADM.ALTER_PROPAGATION_SCHEDULE('source_queue_name','destination',destination_queue=>'specific_queue');
Changing the GLOBAL_NAME of the Source Database
See the OPERATION section on Global_name below. The following are some
additional considerations when running in a RAC environment.
If the GLOBAL_NAME of the database is changed, ensure that any propagations
are dropped and recreated with the queue_to_queue parameter set to TRUE.
In addition, if the GLOBAL_NAME does not match the db_name.db_domain of the
database, include the global_name for the queue (NETWORK_NAME in DBA_QUEUES)
in the list of services for the database in the database parameter
initialization file.
Section 4. Target Site Configuration
The following recommendations apply to target databases, ie, databases in which
Streams apply is configured.
1. Privileges
Grant Explicit Privileges to APPLY_USER for the user tables
Examples:
Privileges for table level DML: INSERT/UPDATE/DELETE,
Privileges for table level DDL: CREATE (ANY) TABLE , CREATE (ANY) INDEX,
CREATE (ANY) PROCEDURE
2. Instantiation
Set Instantiation SCNs manually if not using export/import. If manually
configuring the instantiation scn for each table within the schema, use the
RECURSIVE=>TRUE option on the DBMS_STREAMS_ADM.SET_SCHEMA_INSTANTIATION_SCN
procedure
For DDL Set Instantiation SCN at next higher level(ie,SCHEMA or GLOBAL level).
3. Conflict Resolution
If updates will be performed in multiple databases for the same shared
object, be sure to configure conflict resolution. See the Streams
Replication Administrator's Guide Chapter 3 Streams Conflict Resolution,
for more detail.
To simplify conflict resolution on tables with LOB columns, create an error
handler to handle errors for the table. When registering the handler using
the DBMS_APPLY_ADM.SET_DML_HANDLER procedure, be sure to specify the
ASSEMBLE_LOBS parameter as TRUE.
In Streams Concepts manual 10.2 chapter 22: Monitoring Apply
Displaying detailed information about Apply errors.
4. Apply Process Configuration
A. Rules
If the maintain_* procedures are not suitable for your environment,
please use the ADD_RULES procedures (ADDTABLE_RULES , ADD_SCHEMA_RULES ,
ADD_GLOBAL_RULES (for DML and DDL), ADD_SUBSET_RULES (DML only).
These procedures minimize the number of steps required to configure Streams
processes. Also, it is possible to create rules for non-existent objects,
so be sure to check the spelling of each object specified in a rule carefully.
APPLY can be configured with or without a ruleset. The ADD_GLOBAL_RULES can
be used to apply all changes in the queue for the database. If no ruleset is
specified for the apply process, all changes in the queue are processed by the apply process.
A single Streams apply can process rules for multiple tables or schemas
located in a single queue that are received from a single source database .
For best performance, rules should be simple. Rules that include LIKE clauses are
not simple and will impact the performance of Streams.
To eliminate changes for particular tables or objects, specify the
include_tagged_lcr clause along with the table or object name in the
negative rule set for the Streams process. Setting this clause will
eliminate all changes, tagged or not, for the table or object.
B. Parameters
Set the following parameters after a apply process is created:
+ DISABLE_ON_ERROR=N Default: Y
If Y, then the apply process is disabled on the first unresolved error,
even if the error is not fatal.
If N, then the apply process continues regardless of unresolved errors.
+ PARALLELISM=3* Number of CPU Default: 1
Apply parameters can be set using the SET_PARAMETER procedure from the
DBMS_APPLY_ADM package. For example, to set the DISABLE_ON_ERROR parameter
of the streams apply process named APPLY_EX, use the following syntax while
logged in as the Streams Administrator:
exec dbms_apply_adm.set_parameter('apply_ex','disable_on_error','n');
Change the apply parallelism parameter recommendation to a lower number.
In general, try 4 or 8 and increase or decrease as necessary for your workload.
In some cases, performance can be improved by setting the following hidden
parameter. This parameter should be set when the major workload is UPDATEs
and the updates are performed on just a few columns of a many-column table.
+ DYNAMICSTMTS=Y Default: N
If Y, then for UPDATE statements, the apply process will optimize the
generation of SQL statements based on required columns.
CHECKPOINTFREQUENCY=1000
Increase the frequency of logminer checkpoints especially in a
database with significant LOB or DDL activity.
exec dbms_capture_adm.set_parameter('capture_ex','_checkpoint_frequency','1000');
5. Additional Configuration for RAC Environments for a Apply Database
Queue Ownership
When Streams is configured in a RAC environment, each queue table has an
"owning" instance. All queues within an individual queue table are owned
by the same instance. The Streams components (capture/propagation/apply)
all use that same owning instance to perform their work. This means that
the database link specified in the propagation must connect to the owning
instance of the target queue. the apply process is run at the owning instance
of the target queue
Ownership of the queue can be configured to remain on a specific instance,
as long as that instance is available, by setting the PRIMARY _INSTANCE and
SECONDARY_INSTANCE parameters of DBMS_AQADM.ALTER_QUEUE_TABLE. If the
primary_instance is set to a specific instance (ie, not 0), the queue
ownership will return to the specified instance whenever the instance is up.
Apply will automatically follow the ownership of the queue. If the ownership
changes while apply is running, apply will stop on the current instance and
restart at the new owner instance.
Changing the GLOBAL_NAME of the Database
See the OPERATION section on Global_name below. The following are some
additional considerations when running in a RAC environment.
If the GLOBAL_NAME of the database is changed, ensure that the queue is
empty before changing the name and that the apply process is dropped and
recreated with the apply_captured parameter = TRUE. In addition, if the
GLOBAL_NAME does not match the db_name.db_domain of the database, include
the GLOBAL_NAME in the list of services for the database in the database
parameter initialization file. -
Is there any way to get a already created instance of a object?
Is there any way to get a already created instance of a object not a new intance?
Is there any way to get the last time that a object instance state has been changed?
Is there any way to get a clue that a instance is being used?Is there any way to get a already created instance of
a object not a new intance? It sounds like you want a "singleton". Here is a simple example
public class SingletonObject
private static SingletonObject ref;
private SingletonObject()
// no code req'd, put what is needed
public static SingletonObject getSingletonObject()
if (ref == null)
// it's ok, we can call this constructor
ref = new SingletonObject();
return ref;
}SingletonObject.getSingletonObject() will return you the single instance of SingletonObject. You can only get an instance throught this factory method. new SingletonObject() won't work since the constructor is private.
Is there any way to get the last time that a object
instance state has been changed?
Is there any way to get a clue that a instance is
being used?Stick methods in SingletonObject and getSingletonObject to keep trace of what you want to.
For a full explanation see
http://www.javacoffeebreak.com/articles/designpatterns/
Maybe you are looking for
-
Please teach me how to make the arrangement using Code Interface Node.
How is what is necessary just to make arrangement (for example, Sine?Wave) using Code Interface Node? Please teach me a way.
-
I have been seeing this too. I edit on a mac pro: Intel Dual Quad core 24 gb DDR2 SDRAM NVIDIA GeForce 8800 GT, Dual monitors OSX 10.6: Snow Leopard CS5 all updates applied. Every time I export within PPro, the file exports perfectly but then PPro fr
-
Dear all, How to process in case if we receive customs invoice for additional duties after processing of initial invoice. Scenario in detail : We have created import po. For that we posted the customs iv. Payment also cleared to customs . No GRN is y
-
Hi, I am developing a webdynpro application.am creating pop-up window for that when am trying to declare a attribute called WD_COMP_Controller type ig_componentcontroller for a view, It s throwing an error like "Field Wd_comp_controller is unknown"
-
WGM Printer Preference Problem
I manage a school mac lab environment with about 5 labs of 30 macs total per lab. Each lab has a designated HP LaserJet 8100 series network printer in it. The printer is setup on a Windows Server and I can print to it successfully via LDP. What my pr