We already have org.wso2.carbon.core.deployment.DeploymentSynchronizer in
the kernel. You will need to introduce the following method to that
interface.

Status getStatus(int tenantId, String artifactPath)

In DeploymentIntercetor, you can call that interface.
If status == NEW, then create the metafiles, else treat it as an existing
service init.

On Mon, Apr 23, 2012 at 1:44 PM, Afkham Azeez <[email protected]> wrote:

>
>
> On Mon, Apr 23, 2012 at 1:08 PM, Kasun Gajasinghe <[email protected]> wrote:
>
>>
>> On Mon, Apr 23, 2012 at 12:23 PM, Afkham Azeez <[email protected]> wrote:
>>
>>> A solution to this came to my mind just now. We can handle this by
>>> making the DeploymentInterceptor aware of the DeploymentSynchronizer.
>>>
>>> If the DeploymentInterceptor detects that a newly added artifact has
>>> been added through an update done by the DepSync, it should refrain from
>>> creating the metafiles. This is because, the assumption is there will be
>>> corresponding metafiles for the newly added artifacts will also exist. If
>>> the DeploymentInterceptor detects that the newly added artifact has been
>>> created locally, and not yet committed by the DepSync, then it can go ahead
>>> with creating local metafiles.
>>>
>>>
>> Great. I'll have a look at this. Handling this from Deployment
>> Interceptor seems to be the correct solution. I'm not sure whether
>> detecting the newly created artifacts isn't committed by DepSync as a check
>> is correct though. That's because the services are not deployed immediately
>> after uploading. DepSync may run within the time period of service upload
>> time to service deployment time!
>>
>
> DeploymentSynchronization & call to Axis2 DeploymentEngine run in the same
> thread.
>
>
>>
>> Thanks,
>> --KasunG
>>
>>
>>>
>>> On Mon, Apr 23, 2012 at 12:13 PM, Kasun Gajasinghe <[email protected]>wrote:
>>>
>>>>
>>>> Hi,
>>>> I've been looking at how the service metadata files propagate to other
>>>> cluster nodes. I'm using SVN-based depsync. But I've faced to an issue.
>>>> Here, what happens is that Deployment Synchronizer propagates the
>>>> service archives to the other nodes. And then DeploymentInterceptor creates
>>>> service metadata files in the master node. After that slave nodes' DI also
>>>> creates service metafiles by themselves. This causes an issue when one node
>>>> committed these metadata files, and another tried to checkout it because
>>>> those have unversioned metadata files in their working copy.
>>>>
>>>> Following is the error I get for one metadata file named Version.xml.
>>>>
>>>> [2012-04-23 11:53:52,731] ERROR
>>>> {org.wso2.carbon.deployment.synchronizer.subversion.SVNBasedArtifactRepository}
>>>> -  Error while checking out or updating artifacts from the SVN repository
>>>> org.tigris.subversion.svnclientadapter.SVNClientException:
>>>> org.tigris.subversion.svnclientadapter.commandline.CmdLineException: svn:
>>>> Failed to add file
>>>> '/wso2/cluster-test/cluster-manager/wso2as-4.5.0-SNAPSHOT/repository/deployment/server/servicemetafiles/Version.xml':
>>>> *an unversioned file of the same name already exists*
>>>>
>>>> at
>>>> org.tigris.subversion.svnclientadapter.SVNClientException.wrapException(SVNClientException.java:93)
>>>> at
>>>> org.tigris.subversion.svnclientadapter.commandline.CmdLineClientAdapter.update(CmdLineClientAdapter.java:596)
>>>>  at
>>>> org.wso2.carbon.deployment.synchronizer.subversion.SVNBasedArtifactRepository.checkout(SVNBasedArtifactRepository.java:231)
>>>> at
>>>> org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizer.checkout(DeploymentSynchronizer.java:144)
>>>>  at
>>>> org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizerServiceImpl.update(DeploymentSynchronizerServiceImpl.java:59)
>>>> at
>>>> org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.doDeploymentSynchronization(CarbonDeploymentSchedulerTask.java:101)
>>>>  at
>>>> org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:70)
>>>> at
>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>>>>  at
>>>> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>>>> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>>>>  at
>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>>>> at
>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
>>>>  at
>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
>>>> at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>  at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>> at java.lang.Thread.run(Thread.java:662)
>>>> Caused by:
>>>> org.tigris.subversion.svnclientadapter.commandline.CmdLineException: svn:
>>>> Failed to add file
>>>> '/wso2/cluster-test/cluster-manager/wso2as-4.5.0-SNAPSHOT/repository/deployment/server/servicemetafiles/Version.xml':
>>>> an unversioned file of the same name already exists
>>>>
>>>> at
>>>> org.tigris.subversion.svnclientadapter.commandline.CommandLine.execString(CommandLine.java:239)
>>>> at
>>>> org.tigris.subversion.svnclientadapter.commandline.SvnCommandLine.update(SvnCommandLine.java:802)
>>>>  at
>>>> org.tigris.subversion.svnclientadapter.commandline.CmdLineClientAdapter.update(CmdLineClientAdapter.java:593)
>>>> ... 14 more
>>>> [2012-04-23 11:53:52,732] ERROR
>>>> {org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask} -
>>>>  Deployment synchronization for tenant 0 failed
>>>> java.lang.RuntimeException:
>>>> org.wso2.carbon.deployment.synchronizer.DeploymentSynchronizerException:
>>>> Error while checking out or updating artifacts from the SVN repository
>>>>  at
>>>> org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizerServiceImpl.update(DeploymentSynchronizerServiceImpl.java:62)
>>>> at
>>>> org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.doDeploymentSynchronization(CarbonDeploymentSchedulerTask.java:101)
>>>>  at
>>>> org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:70)
>>>> at
>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>>>>  at
>>>> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
>>>> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>>>>  at
>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>>>> at
>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
>>>>  at
>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
>>>> at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>>  at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>> at java.lang.Thread.run(Thread.java:662)
>>>> Caused by:
>>>> org.wso2.carbon.deployment.synchronizer.DeploymentSynchronizerException:
>>>> Error while checking out or updating artifacts from the SVN repository
>>>> at
>>>> org.wso2.carbon.deployment.synchronizer.subversion.SVNBasedArtifactRepository.handleException(SVNBasedArtifactRepository.java:318)
>>>>  at
>>>> org.wso2.carbon.deployment.synchronizer.subversion.SVNBasedArtifactRepository.checkout(SVNBasedArtifactRepository.java:240)
>>>> at
>>>> org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizer.checkout(DeploymentSynchronizer.java:144)
>>>>  at
>>>> org.wso2.carbon.deployment.synchronizer.internal.DeploymentSynchronizerServiceImpl.update(DeploymentSynchronizerServiceImpl.java:59)
>>>> ... 11 more
>>>> Caused by: org.tigris.subversion.svnclientadapter.SVNClientException:
>>>> org.tigris.subversion.svnclientadapter.commandline.CmdLineException: svn:
>>>> Failed to add file
>>>> '/wso2/cluster-test/cluster-manager/wso2as-4.5.0-SNAPSHOT/repository/deployment/server/servicemetafiles/Version.xml':
>>>> an unversioned file of the same name already exists
>>>>
>>>> at
>>>> org.tigris.subversion.svnclientadapter.SVNClientException.wrapException(SVNClientException.java:93)
>>>> at
>>>> org.tigris.subversion.svnclientadapter.commandline.CmdLineClientAdapter.update(CmdLineClientAdapter.java:596)
>>>>  at
>>>> org.wso2.carbon.deployment.synchronizer.subversion.SVNBasedArtifactRepository.checkout(SVNBasedArtifactRepository.java:231)
>>>> ... 13 more
>>>> Caused by:
>>>> org.tigris.subversion.svnclientadapter.commandline.CmdLineException: svn:
>>>> Failed to add file
>>>> '/wso2/cluster-test/cluster-manager/wso2as-4.5.0-SNAPSHOT/repository/deployment/server/servicemetafiles/Version.xml':
>>>> an unversioned file of the same name already exists
>>>>
>>>> at
>>>> org.tigris.subversion.svnclientadapter.commandline.CommandLine.execString(CommandLine.java:239)
>>>> at
>>>> org.tigris.subversion.svnclientadapter.commandline.SvnCommandLine.update(SvnCommandLine.java:802)
>>>>  at
>>>> org.tigris.subversion.svnclientadapter.commandline.CmdLineClientAdapter.update(CmdLineClientAdapter.java:593)
>>>> ... 14 more
>>>>
>>>>
>>>> --
>>>> *Kasun Gajasinghe*
>>>> Software Engineer; WSO2 Inc.; http://wso2.com
>>>>
>>>> ,
>>>> *email: **kasung AT spamfree wso2.com** cell: **+94 (77) 678-0813*
>>>> *linked-in: *http://lk.linkedin.com/in/gajasinghe*
>>>> *
>>>>  *blog: **http://blog.kasunbg.org* <http://blog.kasunbg.org>
>>>>
>>>> *
>>>> twitter: **http://twitter.com/kasunbg* <http://twitter.com/kasunbg>
>>>>
>>>> *
>>>> *
>>>>
>>>>
>>>
>>>
>>> --
>>> *Afkham Azeez*
>>> Director of Architecture; WSO2, Inc.; http://wso2.com
>>> Member; Apache Software Foundation; http://www.apache.org/
>>> * <http://www.apache.org/>**
>>> email: **[email protected]* <[email protected]>* cell: +94 77 3320919
>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
>>> twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
>>> *
>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez*
>>> *
>>> *
>>> *Lean . Enterprise . Middleware*
>>>
>>>
>>
>>
>> --
>> *Kasun Gajasinghe*
>> Software Engineer; WSO2 Inc.; http://wso2.com
>>
>> ,
>> *email: **kasung AT spamfree wso2.com** cell: **+94 (77) 678-0813*
>> *linked-in: *http://lk.linkedin.com/in/gajasinghe*
>> *
>>  *blog: **http://blog.kasunbg.org* <http://blog.kasunbg.org>
>>
>> *
>> twitter: **http://twitter.com/kasunbg* <http://twitter.com/kasunbg>
>>
>> *
>> *
>>
>>
>
>
> --
> *Afkham Azeez*
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> * <http://www.apache.org/>**
> email: **[email protected]* <[email protected]>* cell: +94 77 3320919
> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
> twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
> *
> linked-in: **http://lk.linkedin.com/in/afkhamazeez*
> *
> *
> *Lean . Enterprise . Middleware*
>
>


-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com
Member; Apache Software Foundation; http://www.apache.org/
* <http://www.apache.org/>**
email: **[email protected]* <[email protected]>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to