You'll not be able to touch the code of the second batch, of course, because it's a managed class. That leaves you with really only two options.
The first is polling. Your code runs on a schedule - as Schedulable Apex - and runs Apex queries to determine whether the second batch has completed, successfully or not; once it observes completion, it kicks off the third batch class in your sequence. Without knowing more about the data operations performed by the second batch class, it's hard to be more specific. Here, you could for example pass the Schedulable class the Apex job Id of the second batch class, so you could actually take a look at its progress, and you could also supply the Schedulable class with information about the scope of records impacted, which could persist through to the third batch class.
The second approach is event-driven. You'd create a trigger on the record that's mutated by the second batch class, and have that trigger call a service class that similarly queries to determine whether or not your second batch has completed.
It's trickier to see with the second approach how you'd determine that a single discrete process had completed and take action. Perhaps you'd query AsyncApexJob
based on the ApexClassID
corresponding to your second batch class. But I think you'd need a second store of data about in-process operations (say a cache in some sObject or custom setting, initialized by your first batch class, about second-batch-class jobs that have been initiated) so that you can tell when a completion even has happened and collect any additional required details (like record scope) to pass to an invocation of your third batch class.
I'd probably take the former approach, and I think it's more likely to be the correct solution based on what information you've shared.. But this is highly fact-specific as far as the design goes, and you'll need to look hard at how you can persist job details across these several asynchronous processes to ensure that you're able to ensure continuity across the job, as well as error recovery and reporting.